Main menu puzzle, Klaus
J. Landman Gay
jacque at hyperactivesw.com
Sat Feb 18 16:56:32 CST 2006
Garrett Hylltun 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.
There is an advantage to using switch statements though when several
options need to result in the same behavior. For example:
if tColor = "red" or tColor = "blue" or tColor = "purple" or tColor =
else if tColor = "black" or tColor = "white" then
Sometimes these constructs can get very complicated, at least visually.
A switch/case statement "falls through" to the next line unless it hits
a "break", so the above can be represented instead like this:
The above construction is easier for me to read and executes faster in a
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode