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
End if
Hershel
I believe Shao Sean is correct, at least as far as the initial condition
goes.
Of course when nesting if the first one is false then the nested ones
won't be evaluated.
Also, Rev's if is fairly well optimized, so in a single if with multiple
conditions like this:
if (1=2) AND ("r" is in "richard") then
...the second test won't be tried since the first one isn't true.
This can be helpful to keep in mind when writing multi-condition ifs,
putting the least likely one in front to minimize subsequent processing.
--
Richard Gaskin
Managing Editor, revJournal
_______________________________________________________
Rev tips, tutorials and more: http://www.revJournal.com
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution