Re: Goto Examples?

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

Fernando Bauer wrote:
I'm not 100% sure I understood the flow, but here is my goto-less attempt.

 ...
 label AA
 while 1 do
 	-- Show A
 	key = get_key()
 	if (key = BACK) then exit AA end if
 	...
        label BB
 	while 1 do
 		-- Show B
 		key = get_key()
 		if (key = BACK) then next AA end if
 		...
                label CC
 		while 1 do
 			-- Show C
 			key = get_key()
 			if (key = BACK) then next BB end if
 			...
 		end while
 	end while
 end while
 return
 
> This solution with 'goto' is cleaner and more simple:

I think your 'goto' version has a few 'while loops' omitted, no?

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

Search



Quick Links

User menu

Not signed in.

Misc Menu