Re: New switch/case idea
- Posted by jeremy (admin) Apr 06, 2009
- 1838 views
DerekParnell said...
That should still work in Euphoria too, but it doesn't at the moment. I think this is a bug. To get it to work currently you have to add a label to the break clause...
switch X label "A" do case 1 then . . . if cond then break "A" end if
break will exit the if statement, which I am not sure is something we should actually do. So, your break statement in the example, breaks from the if, not the switch. If you had
integer X = 1 switch X do case 1 then X = 2 break X = 3 end switch ? X
it will print 2.
Jeremy