Transcript handling of OR and AND expressions

Jim Lyons jimlyons at earthlink.net
Mon Jan 26 07:16:36 EST 2004


The docs don't say AFAIK, but I always wondered, so just now I tested 
this. It's a good thing to know about sometimes.

If the engine is working on a statement like:

if switchA or switchB then doSomething

and switchA evaluates to true, then switchB is not evaluated; this can 
be important if switchB is an expression that has side effects, or if 
it contains an expression that wouldn't be valid if switchA is true. 
For example,

if x1= x2 or (y1-y2)/(x1-x2)=z then doSomething

Similarly, if you have:

if switchA and switchB then doSomething

and switchA evaluates to false, then switchB will not be evaluated.

Hope this is helpful to someone.

Jim Lyons



More information about the use-livecode mailing list