If statements vs case

Hershel Fisch hershf at rgllc.us
Wed Feb 28 20:33:33 EST 2007


On 2/28/07 7:45 PM, "Shao Sean" <shaosean at wehostmacs.com> wrote:
Thanks a mill
Hershel

>> Sorry, what do you mean that IF-ELSE-IF is always evaluated?
> 
> If you have a 20 line nested IF-ELSE-IF statement and the one that
> matches your current situation is the 20th one, the previous 19 are
> evaluated (thankfully Rev uses some short-circuited methods to speed it
> up)
> 
> In a SWITCH statement the engine/compiler converts the CASE statements
> into a hashed lookup table (think fast) and as such when the SWITCH
> statement is evaluated it just quickly looks up the code to run in the
> hash table.
> 
> As I mentioned in my first posting, if you're only using the IF-ELSE-IF
> statement a few times, you don't have to wait for the SWITCH lookup
> table to be hashed (adding overhead the first time a SWITCH statement
> is called)
> 
> Also mentioned in my first posting, how much of this applies to
> Revolution in general only they know, as Revolution allows you to some
> weird things with the SWITCH statements that you couldn't do in other
> languages (apparently a lot of languages the result of the SWITCH
> statement can only be an integer)
> 
> -Sean
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list