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=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,999172cfe4113340 X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: How to implement a continue statement in Ada? Date: 2000/02/09 Message-ID: <87s92d$lj1$1@nnrp1.deja.com>#1/1 X-Deja-AN: 583719094 References: <87pgm3$o3p$1@nnrp1.deja.com> <87pmrq$9ae1@news.cis.okstate.edu> X-Http-Proxy: 1.0 x43.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Wed Feb 09 17:44:46 2000 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.7 [en] (WinNT; I) Date: 2000-02-09T00:00:00+00:00 List-Id: In article , Aidan Skinner wrote: > I would expect this case to be picked up by the compiler, without the > need for an explicit goto. Was there a reason why the appropriate > section of code couldn't be put into a (possibly nested) procedure and > recurse itself? That does raise a good issue. Often when this comes up I will fudge it by putting the code in the loop inside of a subroutine, from which I can simulate continue with a "return". This could also be done with an "exit" statement by putting the code in another loop that has an "exit;" at the end. But that looks silly, while the subroutine often makes some sense in and of itself. Given that such workarounds (hacks) exist, why not put continue capability in Ada 0X by allowing the "exit" statement to exit outside of a begin..end block? The fact that you can't do this is actually a common confusion for newbies anyway. I'll admit its a bit "heavy" of a solution, since it involves another level of nesting. But it has some advantages to offset that. The existence of the block would tip readers off that a early termination may exist. Also, this is more powerful that a meer "continue", because you can explicitly specify the scope of the statements that get skipped. For instance, you could have some extra code outside of the block at the end of the loop that does not get skipped. -- T.E.D. http://www.telepath.com/~dennison/Ted/TED.html Sent via Deja.com http://www.deja.com/ Before you buy.