johnjces Posted Tuesday at 10:45 PM Posted Tuesday at 10:45 PM (edited) I have three (3) ANDed conditions that must be met before an action, (THEN), can occur. what is best practice in IOX. As I recall from past programming in IOX parenthesis' must be used for ANDing or ORing at times. XOR and XAND. I always get this stuff mixed up these days! So, is the following best, (pretty exclusive that the first two conditions must be met), practice... If ( 'Double Garage Door-Sensor' Status is On And $Can_Close is 1 ) And $s_GarageDoorIsOPEN is 1 Then ..... or is the code snippet the next best method to ensure that all 3 conditions are in fact met. If ( 'Double Garage Door-Sensor' Status is On And $Can_Close is 1 And $s_GarageDoorIsOPEN is 1 ) Then .... Thanks!! John Edited Tuesday at 10:46 PM by johnjces Quote
Solution Guy Lavoie Posted Tuesday at 11:19 PM Solution Posted Tuesday at 11:19 PM The second one seems to best reflect what you want to do, visually. Both are actually equivalent. Quote
apostolakisl Posted Thursday at 09:35 PM Posted Thursday at 09:35 PM On 7/1/2025 at 6:41 PM, johnjces said: Thank-you sir! You don't need parenthesis at all for this. There is no functional difference between either of the two options you showed as well as no parenthesis at all. Mostly you would use parenthesis when you have two sets of conditions not connected by the same and/or. ie. (1 and 2 and 3) or (4 and 5) (1 or 2 or 3) and (4 or 5) the following are all functionally identical (1 and 2 and 3) (1 and 2) and 3 1 and (2 and 3) 1 and 2 and 3 (1 and 3) and 2 3 Quote
johnjces Posted Friday at 03:12 PM Author Posted Friday at 03:12 PM @apostolakisl Thank-you! John Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.