Re: goto: it's conceded
- Posted by Derek Parnell <ddparnell at bigpond?com> Jun 02, 2008
- 682 views
ken mortenson wrote: > > Derek Parnell wrote: > > > David Cuny wrote: > > > Well, sometimes you're nested deep, and you need to get out. Implementing > > > it > > > > > > without GOTO is messy and error prone. With GOTO, it's clear > > > what's happening and it executes as expected. > > Sorry to contradict you I assume 'you' here means David and not myself. > but your example demostrates perfectly (with some > elaboration) exactly why GOTO result in less clear code. > Thank you I assume 'you' here means myself and not David. > for providing an example that allows me to make this point... > > > We can now do this (in V4.0) ... > > > > while cond1 label "toplevel" do > > . . . > > while cond2 do > > . . . > > while cond3 label "anotherpoint" do > > . . . > > while cond4 do > > . . . > > if abc then > > exit "toplevel" > > else > > continue "anotherpoint" > > end if > > end while > > end while > > end while > > end while > > Any person that wrote this probably expects... > > while cond4 do > > ...to be the beginning of a loop. Does everybody see that? AARRRRGG!!! You missed the point ken. Okay, in this example which I spent all of 5 seconds writing, I missed a minor part which would help my case more. The example should have been written ... while cond1 label "toplevel" do . . . while cond2 do . . . while cond3 label "anotherpoint" do . . . while cond4 do . . . if cond5 then exit "toplevel" end if . . . if cond6 then continue "anotherpoint" end if . . . end while . . . end while . . . end while . . . end while I was JUST trying to show that the NEED for goto in v4.0 is not as great, IN THIS SITUATION, as one might have thought. That's all. -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell