TIP: How to emulate "AND" and "OR" in "IF" statements
Bean
Posts: 8,129
Okay so SX/B doesn't have compound IF conditions.
Emulating "AND" is not hard at all. Simply use:
But "OR" is a little bit harder, but here is how to do it without needing any additional variables:
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"I'm a man, but I can change, if I have to, I guess" The Red Green Show
·
Emulating "AND" is not hard at all. Simply use:
' Emulate IF (a=1) AND (b=2) THEN IF a = 1 THEN IF b = 2 THEN ' CODE HERE RUNS IF a=1 AND b=2 ENDIF ENDIF
But "OR" is a little bit harder, but here is how to do it without needing any additional variables:
' Emulate IF (a=1) OR (b=2) THEN DO IF a <> 1 THEN ' Use Opposite Condition Here IF b <> 2 THEN EXIT 'Use Opposite Condition Here ENDIF ' CODE HERE RUNS IF a=1 OR b=2 LOOP UNTIL a = a ' Use A Condition that is always true
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
"I'm a man, but I can change, if I have to, I guess" The Red Green Show
·