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,FREEMAIL_FROM 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 19:11:01 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!attbi_s51.POSTED!not-for-mail From: "Steve" Newsgroups: comp.lang.ada References: Subject: Re: "continue/next" for "loop" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: <9NEpb.76189$ao4.212504@attbi_s51> NNTP-Posting-Host: 12.211.58.135 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s51 1067915461 12.211.58.135 (Tue, 04 Nov 2003 03:11:01 GMT) NNTP-Posting-Date: Tue, 04 Nov 2003 03:11:01 GMT Organization: Comcast Online Date: Tue, 04 Nov 2003 03:11:01 GMT Xref: archiver1.google.com comp.lang.ada:2020 Date: 2003-11-04T03:11:01+00:00 List-Id: Not so elegant but: procedure t is begin for j in 2 .. 8 loop for i in 2 .. 8 loop inner_context: loop if i mod j = 0 then -- Assume complex statements here. exit inner_context; -- In my real case, it's another loop, end if; -- which detects the end of current path inside. Put(i'Img); exit inner_context; end loop inner_context; end loop; New_Line; end loop; end t; which is basicly the same as the goto, but works for those with goto allergies. Steve (The Duck) "Lutz Donnerhacke" wrote in message news:slrnbqccj0.m1.lutz@taranis.iks-jena.de... > I might be out of coffee, but I do not find an elegant way to skip the rest > of a loop body for the current cycle other than using "goto". > > with Ada.Text_IO; use Ada.Text_IO; > > procedure t is > begin > for j in 2 .. 8 loop > for i in 2 .. 8 loop > if i mod j = 0 then -- Assume complex statements here. > goto next; -- In my real case, it's another loop, > end if; -- which detects the end of current path inside. > Put(i'Img); > <> null; > end loop; > New_Line; > end loop; > end t; >