MikeB Posted November 18, 2007 Posted November 18, 2007 If I create a program that contains both an 'and' and an 'or' in the IF statement, how does it get parsed? IF status "switch 1" is on and status of "switch 2" is on or status of "switch 3" is on Is it parsed like this: IF [status "switch 1" is on and status of "switch 2" is on] or status of "switch 3" is on or like this: IF status "switch 1" is on and [status of "switch 2" is on or status of "switch 3" is on] It might be nice to clarify that in the program content window when the commands are entered. Quote
Chris Jahn Posted November 18, 2007 Posted November 18, 2007 Hi Mike, All the And conditions are grouped together, making your first example the correct one. i.e. A and B or C and D is equivalent to (A and or (C and D) Quote
MikeB Posted November 18, 2007 Author Posted November 18, 2007 Thanks... So, I can combine these 2 programs: If Program 'Floor 1 Status Update' is False And Status 'FoyerControls1G' is not Off Then Set Scene 'Floor1StatusLight' Off Else - No Actions - (To add one, press 'Action') If Program 'Floor 1 Status Update' is False And Status 'MasterBedControls1G' is not Off Then Set Scene 'Floor1StatusLight' Off Else - No Actions - (To add one, press 'Action') ..with this: If Program 'Floor 1 Status Update' is False And Status 'FoyerControls1G' is not Off Or Program 'Floor 1 Status Update' is False And Status 'MasterBedControls1G' is not Off Then Set Scene 'Floor1StatusLight' Off Else - No Actions - (To add one, press 'Action') Correct? Quote
Chris Jahn Posted November 18, 2007 Posted November 18, 2007 Yes, you can combine these programs. You should also be aware of the And (...) / Or (...) buttons, they allow you to explicitly specify parentheses so you can have more complex programs. Quote
MikeB Posted November 18, 2007 Author Posted November 18, 2007 Doh!!!! I didn't even see that! OK, so is this the equivelant? If Program 'Floor 1 Status Update' is False And ( Status 'MasterBedControls1G' is not Off Or Status 'FoyerControls1G' is not Off ) Then Set Scene 'Floor1StatusLight' Off Else - No Actions - (To add one, press 'Action') Quote
yardman 49 Posted November 19, 2007 Posted November 19, 2007 Mike: That looks to me like it should work. I used the parentheticals already in one program and they worked as expected. Best wishes, 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.