What if....

Robert Sneidar slylabs13 at me.com
Tue Jan 29 14:45:09 EST 2013

Yes. You can do stuff in between the conditionals in example 2 whereas you cannot in example one. 


On Jan 27, 2013, at 10:39 AM, Peter Haworth wrote:

> Musings about complex if statements on this Sunday morning....
> Lets say you have a complex if statement with 4 conditions that must all be
> true.  Is there any advantage, other than personal preference/style, to:
> if cond1 and cond2 and cond3 and cond4 then.....
> or
> if cond1 then
>   if cond2 then
>      if cond3 then
>         if cond4 then...
> In either case, as soon as a condition evaluates to false, none of the rest
> are evaluated, right?  If so, then always best to put the conditions that
> take the longest to evaluate further down the list, for example perhaps an
> SQL SELECT statement that might take a while to execute?  But then what if
> some of the conditions are in parens, for example:
> if cond1 and cond2 and (cond3 and cond4) then....
> The manual says the grouping operator (parens) has the highest precedence
> so does this mean (cond3 and cond4) will be evaluated before cond1 and
> cond2?
> Just curious.
> Pete
> lcSQL Software <http://www.lcsql.com>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

More information about the Use-livecode mailing list