Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Evaluating if's

From: gscottjones::mchsi::com at: 2-Jul-2002 4:42

From: "Charles"
> Here's a little question. Perhaps I've been > spoiled in other languages, but this is starting > to frustrate me. I have something like: > if THIS and THAT [] > Thing is, if THIS is false, it continues to > evaluate THAT anyways. What's the point? > The result is obviously false anyways. I'm > working on a case like this (perhaps > someone can provide a more elegant solution): > if (2 = length? p: parse filename ".") AND (not none? find pick p 2
htm )
> [ ... > Obviously, if the first condition is false, > I want it to quit without evaluating the second > condition. Help? Any way I can continue doing > this in the same line, and without worrying about > throwing and catching errors? Or am I more or > less doomed to yet another nested if? Thanks folks.
Hi, Charles, Two helpful words are 'any and 'all. An ad hoc session at a *fresh* console demonstrates that 'all short cuts if false: if all [1 > 2 c: 3 = 3] [ print "hello"] ;== none probe c ;;;;;value of c was not set ;** Script Error: c has no value ;** Where: connect-to-link ;** Near: probe c if all [1 < 2 c: 3 = 3] [ print "hello"] ;hello probe c ;== true Hope that this both helps and causes REBOL to also spoil you. :-) --Scott Jones