Switch,Case Structure

Yates, Glen JAMES.G.YATES at saic.com
Fri May 17 13:01:01 EDT 2002


My switch and case lines have always been aligned, I just never let it
bother me. :-)

Actually, I noted this behavior a couple of years ago and thought it was odd
(i.e. different from C), but this is just the way switch statements are
displayed in this language, so don't worry about it, you haven't done
anything wrong.

-Glen Yates


> I'm trying to understand the "Switch/Case" structure and 
> having a hard 
> time.
> 
> Let's say I've got a value in myVar that could be anything 
> from 1 to 3. 
> I want to call a handler specific to that value and not any other 
> handler after that. Let's say "doOne", "doTwo", "doThree". 
> According to 
> how I understand the Rev docs on this subject, I would create this:
> 
> switch (myVar)
> 	case 1
> 		doOne
> 		break
> 	case 2
> 		doTwo
> 		break
> 	case 3
> 		doThree
> 		break
> end switch
> 
> When I do this in my handler, the switch and case lines are aligned 
> rather than indented so I've probably pooched something. Any ideas?
 



More information about the use-livecode mailing list