If statements vs case
Hershel Fisch
hershf at rgllc.us
Tue Feb 27 16:05:53 EST 2007
On 2/26/07 3:39 PM, "Richard Gaskin" <ambassador at fourthworld.com> wrote:
> Hershel Fisch wrote:
>> On 2/26/07 2:27 PM, "Shao Sean" <shaosean at wehostmacs.com> wrote:
>>
>>> There are differences between SWITCH and IF-ELSE-IF statements in other
>>> languages, but in regards to Revolution someone from the engine team
>>> would be best to answer it.
>>>
>>> In many languages SWITCH statements are converted into a hash table for
>>> much quicker lookups and using a SWITCH once or twice is slower than
>>> using an IF-ELSE-IF statement due to the SWITCH statement getting
>>> hashed, but using the same SWITCH statement multiple times will
>>> increase the speeds.
>>> Also, because of the fact that an IF-ELSE-IF statement is _always_
>>> evaluated, they can never be faster than a SWITCH statement (they can
>>> be just as fast, but never faster)
>> Sorry, what do you mean that IF-ELSE-IF is always evaluated?
>> Dosn't the "else" break it?
>> If
>> else
>> if
>> end if
Ok we got it, Now the question arises how is it in the "case" statements to
write an "else" without a following "if"
Switch tS
case "a"
do a
break
'''Else'''
Do b
End switch
Thanks, to all Hershel
More information about the use-livecode
mailing list