MikeB Posted November 18, 2007 Share 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. Link to comment
Chris Jahn Posted November 18, 2007 Share 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) Link to comment
MikeB Posted November 18, 2007 Author Share 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? Link to comment
Chris Jahn Posted November 18, 2007 Share 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. Link to comment
MikeB Posted November 18, 2007 Author Share 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') Link to comment
yardman 49 Posted November 19, 2007 Share 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, Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.