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-03 05:38:01 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: "continue/next" for "loop" Date: Mon, 03 Nov 2003 14:39:48 +0100 Message-ID: References: NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1067866679 42091240 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:1973 Date: 2003-11-03T14:39:48+01:00 List-Id: On Mon, 3 Nov 2003 13:07:22 +0000 (UTC), Lutz Donnerhacke wrote: >* amado.alves wrote: >>> No. I don't know how to invert a complex loop. >> >> What on Earth are you talking about? The two constructs >> >> (1) if I mod J = 0 then >> goto next; >> end if; >> Put (I'Img); >> <> null; >> >> (2) if I mod J /= 0 then >> Put (I'Img); >> end if; >> >> are clearly equivalent! > >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! It looks that you are implementing a kind of state machine. If so then, it is a rare case where labels are more natural than higher level constructs. --- Regards, Dmitry Kazakov www.dmitry-kazakov.de