OK, so I understand the parens thing now. Any thoughts on the use of multiple ifs vs joining the conditions together with "and". I've always considered that to be just a matter of personal preference and ease of reading but wondering if there might be other implications, like performance for example.
Pete lcSQL Software <http://www.lcsql.com> On Sun, Jan 27, 2013 at 11:27 AM, J. Landman Gay <[email protected]>wrote: > On 1/27/13 12:39 PM, 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? >> > > Right, both examples are equivalent. In the single line version (example > 1) the conditions are evaluated left to right, and as soon as one is false > the rest are abandoned. > > Parentheses indicate which conditions are part of a grouping but don't > influence the direction of evaluation. > > -- > Jacqueline Landman Gay | [email protected] > HyperActive Software | http://www.hyperactivesw.com > > > ______________________________**_________________ > use-livecode mailing list > [email protected] > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode> > _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
