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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,459feef56669b92d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-05 06:45:57 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: jimmaureenrogers@worldnet.att.net (Jim Rogers) Newsgroups: comp.lang.ada Subject: Re: "continue/next" for "loop" Date: 5 Nov 2003 06:45:56 -0800 Organization: http://groups.google.com Message-ID: <82347202.0311050645.88a1411@posting.google.com> References: NNTP-Posting-Host: 209.194.156.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1068043557 17707 127.0.0.1 (5 Nov 2003 14:45:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 5 Nov 2003 14:45:57 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:2088 Date: 2003-11-05T06:45:56-08:00 List-Id: Lutz Donnerhacke wrote in message news:... > But both are the result of an oversimplification! > > outer: loop > inner: loop > Complex_Actions_1; > if First_Condition then > Some_Justify_Actions; > goto next_outer; > end if; > Complex_Actions_2; > if Second_Condition then > Some_Other_Justify_Actions; > goto next_outer; > end if; > Complex_Actions_3; > end loop inner; > Complex_End_Statments; > exit outer when Other_Condition; > More_Statments; > > <> null; > end loop outer; > > I'd like to find a more amazing version of this braindead goto. > Please do not assume, that I'm too stupid to invert a condition in a > simplified example. IT'S NOT HOMEWORK! Upon further consideration of your example above I see that you could look upon the early break out of the inner loop as an exceptional condition, or as a set of exceptional conditions. Given this, another solution is the use of exceptions. First_Condition_Exception : Exception; Second_Condition_Exception : Exception; outer: loop begin inner: loop Complex_Actions_1; if First_Condition then raise First_Condition_Exception; end if; Complex_Actions_2; if Second_Condition then raise Second_Condition_Exception; end if; Complex_Actions_3; end loop inner; Complex_End_Statments; exit outer when Other_Condition; More_Statments; Exception when First_Condition_Exception => Some_Justify_Actions; when Second_Condition_Exception => Some_Other_Justify_Actions; end; end loop outer; Jim Rogers