Re: New switch/case idea

new topic     » goto parent     » topic index » view thread      » older message » newer message
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 smile 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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu