Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!utrcu1!infnews!usenet From: devisser@cs.utwente.nl (Jan de Visser) Newsgroups: comp.lang.pascal Subject: Re: Gotos are ok (Was Re: IMPLEMENT GOTO ACROSS MODULES IN TURBO PASCAL??) Message-ID: <1991Jan26.200550.20184@cs.utwente.nl> Date: 26 Jan 91 20:05:50 GMT References: <2427@bnlux0.bnl.gov> <21489@oolong.la.locus.com> Sender: usenet@cs.utwente.nl Organization: University of Twente, Dept. of Computer Science Lines: 46 In article maine@elxsi.dfrf.nasa.gov (Richard Maine) writes: >On 24 Jan 91 17:38:35 GMT, jfr@locus.com (Jon Rosen) said: > >Jon> can ONLY goto to a SINGLE place... I.e., in the abstract, the programmer >Jon> can't make a mistake... >Jon> >Jon> In the following pseudo-code: >Jon> >Jon> Repeat... >Jon> ... >Jon> if ... then leave; >Jon> ... >Jon> EndRepeat; >Jon> >I wasn't going to enter this religious discussion, *but* I think >there is a factual error in the above. The goto and the exit >are subject to simillar problems. You could just as legitimately >have said "There is only one place the goto statement can place the >program... That is after the label." Both your statement and my >modification ignore the important point that there may be multiple >EndRepeat statements or multiple labels. > Rich, you obviously never programmed in TP. If you ever did, you would know that the TP 'Exit' leaves the current Program Block, that is the Procedure/Function/Main Program. So 'Exit' cannot be misunderstood. A small example: var i:integer; begin i:=1; while true do begin i:=i+1; if i>=10 the exit; end; writeln('This message is never printed.') end. Anyway, I just keep on using whatever language mechanisms it takes to solve my problems. But up to today, I never used a single goto in Pascal (but I did use exit & halt). Jan.