Re: switch design
- Posted by jeremy (admin) Sep 12, 2009
- 1359 views
Fendaril said...
I read the manual on switch design but I don't see much mention of what with faullthrough does. is it like an alternate break?
Hm, the manual needs to be expanded on this subject then. Can you create a ticket for it?
What fallthrough does is this:
integer a = 2 switch a with fallthtru do case 1 then ? 1 break case 2 then ? 2 -- notice no break case 3 then ? 3 break case 4 then ? 4 end switch
The output of the above program is:
2 3
Once an initial match is made (i.e. case 2 then), fallthru causes all remaining case statements to be ignored. They are actually just jumped right over, no test is done.
P.S. I sent an email to your new email address and have not gotten a response. Did you enter your correct address?
Jeremy