Re: New switch/case idea
- Posted by jeremy (admin) Apr 06, 2009
- 1811 views
irv said...
switch op with fallthru do case RETURNT then opRETURNT() break case RHS_SLICE then opRHS_SLICE() break
Just so I understand: If I remove or forget the break after opRETURNT(), then regardless of whether RHS_SLICE is or isn't valid, opRHS_SLICE() gets executed, correct?
Yes. With power comes responsibility The same for while loops:
while 1 do -- do something if condition = FALSE then -- let's break out of the loop here end if -- more code end while
Opps! We forgot a exit there.
Jeremy