Thanks, that's good to know. I'm looking at using a pretty complex condition with some of the conditions being trivial but others taking up significant database access so sounds like I should leave the db access conditions until last.
Hmmm, now I wonder if nested if statements make any difference to this. Probably not. Pete Molly's Revenge <http://www.mollysrevenge.com> On Wed, Oct 5, 2011 at 1:46 PM, Richard Gaskin <ambassa...@fourthworld.com>wrote: > Pete wrote: > > I'm wondering how LC evaluates If statements with multiple conditions. >> Are >> all conditions evaluated before the overall result is checked for true or >> false, or does evaluation proceed left to right and stop as soon as a >> condition is found to be false? Whichever method is used, is it affected >> by >> some conditions being enclosed in parens? >> > > IIRC from discussions with Dr. Raney many years ago, at some point he > implemented an optimization in which the first part of any multi-condition > expression that satisfies the expression avoids the need for evaluation of > other conditions. This normally follows in left-to-right order, but of > course using parens can alter the evaluation order. > > So in this conditional expression: > > if the short name of this cd is "Pete" and $user <> "pete" then > > If the short name of the card <> "Pete" then the engine wouldn't bother > evaluating $user. > > -- > Richard Gaskin > Fourth World > LiveCode training and consulting: http://www.fourthworld.com > Webzine for LiveCode developers: http://www.LiveCodeJournal.com > LiveCode Journal blog: > http://LiveCodejournal.com/**blog.irv<http://LiveCodejournal.com/blog.irv> > > ______________________________**_________________ > use-livecode mailing list > use-livecode@lists.runrev.com > 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 use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode