Main menu puzzle, Klaus

Graham Samuel livfoss at blueyonder.co.uk
Sun Feb 19 02:59:33 EST 2006


On  Sat, 18 Feb 2006 16:56:32 -0600, "J. Landman Gay"  
<jacque at hyperactivesw.com> wrote:
>
>> And to this day, I just don't understand the whole purpose of the   
>> Case
>> statement.....  Still don't even after reading a few of the   
>> replies to
>> this thread.
>>
>
> I prefer switch/case statements when there are many options a  
> script has
> to deal with. I'll admit though that there is little difference  
> between
> switch/case and if/then constructs when the choices are  
> straightforward.

[snip]

> The above construction is easier for me to read and executes faster  
> in a
> script.

Yes, as a programmer who (years ago) used to program at a low level  
(including some compilers), I feel that there's at least the  
possibility that a long case statement can be compiled in such a way  
as to run faster than a lot of 'if' statements. I sense some kind of  
lookup table being used. Of course this may not be the case at all,  
but at least it's faster **in principle**. I admit this is a very  
geeky way of looking at it.

OTOH I agree with all the other people who said a case (switch)  
statement seems clearer than the 'if' construction for long multiple- 
choice logic. I am not at all nostalgic for my low-level days and  
feel thankful every day for the clarity and power of xTalks.

Just my 2 Eurocents

Graham


------------------------------------------------------------------------ 
---
Graham Samuel / The Living Fossil Co. / UK and France




More information about the use-livecode mailing list