From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,99222a5bd46ef3c9 X-Google-Attributes: gid103376,public From: "John G. Volan" Subject: Re: GOTO considered necessary (reworked) Date: 1997/06/12 Message-ID: <33A052FD.6519@sprintmail.com>#1/1 X-Deja-AN: 247952051 References: <5nn2fm$11dk$1@prime.imagin.net> <199706121410.QAA05823@basement.replay.com> Reply-To: johnvolan@sprintmail.com Newsgroups: comp.lang.ada Date: 1997-06-12T00:00:00+00:00 List-Id: Anonymous (Jeff Carter) wrote: > > On 11 Jun 1997 15:40:22 -0500, smize@news.imagin.net (Samuel Mize) > wrote: > > > b) "Continue" loop logic > > > > The "continue" function of C has to be emulated in Ada with a "goto": > > > > loop > > ... > > goto <> > > ... > > <> > > end loop; > > > > This is a special case of the process continuation structure. > > Of course, the code in this example is the same as > > loop > ... -- This is the first "..." in the example > end loop; > > since the second "..." is never executed. Real use of continue involves > a conditional: > > loop > ... -- 1 > > if Condition then > continue; > end if; > > ... -- 2 > end loop; > > (assuming "continue" were part of Ada :). This is equivalent to > > loop > ... -- 1 > > if not Condition then > ... -- 2 > end if; > end loop; > > This is just as readable, and less error-prone on modification than > using a goto. But what if you had this: loop ... --1 if then continue; end if; ... --2 if then continue; end if; ... -- 3 if then continue; end if; ... -- 4 end loop; Without goto or continue, this would have to be restructured as: loop ... --1 if not then ... --2 if not then ... -- 3 if not then ... -- 4 end if; end if; end if; end loop; Whichever side you fall on in this debate, you have to at least agree that a "continue" within a loop is just another example of the "process continuation logic" situation Sam Mize described. ------------------------------------------------------------------------ Internet.Usenet.Put_Signature (Name => "John G. Volan", Employer => "Texas Instruments Advanced C3I Systems, San Jose, CA", Work_Email => "johnv@ti.com", Home_Email => "johnvolan@sprintmail.com", Slogan => "Ada95: World's *FIRST* International-Standard OOPL", Disclaimer => "My employer never defined these opinions, so using " & "them would be totally erroneous...or is that just " & "nondeterministic behavior now? :-) "); ------------------------------------------------------------------------