Re: break bug

new topic     » goto parent     » topic index » view thread      » older message » newer message
ghaberek said...
bryanso said...

The introduction of break statement, causing a confusion between break and exit, seems to violate the principle of "say no to complicated programming".

I suppose this started because we only had exit for the longest time. And only with the recent addition of switch did we gain break.

-Greg

The reason we came up with a new keyword for switch, instead of simply reusing exit, is to allow the user to embed a switch statement inside of a loop but then use the exit keyword inside of the switch to break out of the loop.

E.g.

while still_running do 
	integer k = get_key() 
	switch k do 
		case 'q' then 
			exit 
	end switch 
end while 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu