comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve" <nospam_steved94@comcast.net>
Subject: Re: "continue/next" for "loop"
Date: Tue, 04 Nov 2003 03:11:01 GMT
Date: 2003-11-04T03:11:01+00:00	[thread overview]
Message-ID: <9NEpb.76189$ao4.212504@attbi_s51> (raw)
In-Reply-To: slrnbqccj0.m1.lutz@taranis.iks-jena.de

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" <lutz@iks-jena.de> 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);
>          <<next>> null;
>       end loop;
>       New_Line;
>    end loop;
> end t;
>





  parent reply	other threads:[~2003-11-04  3:11 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-03 10:48 "continue/next" for "loop" Lutz Donnerhacke
2003-11-03 10:51 ` Preben Randhol
2003-11-03 10:55   ` Preben Randhol
2003-11-03 11:01   ` Lutz Donnerhacke
2003-11-04  3:11 ` Steve [this message]
2003-11-05 15:54 ` sk
2003-11-06 15:40   ` Stephen Leake
2003-11-06 18:27     ` sk
2003-11-06 15:39 ` Stephen Leake
  -- strict thread matches above, loose matches on Subject: below --
2003-11-03 12:55 amado.alves
2003-11-03 13:06 ` Lutz Donnerhacke
2003-11-03 13:07 ` Lutz Donnerhacke
2003-11-03 13:25   ` Peter Hermann
2003-11-03 16:49     ` Robert I. Eachus
2003-11-03 18:21       ` (see below)
2003-11-03 18:52       ` Jeffrey Carter
2003-11-03 20:11         ` Lutz Donnerhacke
2003-11-04  1:23         ` Robert I. Eachus
2003-11-03 13:33   ` James Rogers
2003-11-03 13:46     ` Lutz Donnerhacke
2003-11-03 13:39   ` Dmitry A. Kazakov
2003-11-03 13:54   ` Ole-Hjalmar Kristensen
2003-11-03 14:56     ` Lutz Donnerhacke
2003-11-03 15:08   ` Stefan Lucks
2003-11-03 15:40     ` Lutz Donnerhacke
2003-11-05 10:36   ` Charles Lindsey
2003-11-05 18:05     ` Lutz Donnerhacke
2003-11-06  9:48     ` Martin Dowie
2003-11-07 14:54       ` Charles Lindsey
2003-11-07 16:24         ` Martin Dowie
2003-11-07 17:34         ` Jeffrey Carter
2003-11-05 14:45   ` Jim Rogers
2003-11-03 13:45 christoph.grein
2003-11-03 14:23 ` Preben Randhol
2003-11-03 15:01   ` Lutz Donnerhacke
2003-11-03 15:19     ` Dmitry A. Kazakov
2003-11-03 18:33       ` Chad R. Meiners
2003-11-03 15:48     ` Preben Randhol
2003-11-03 18:50     ` Georg Bauhaus
2003-11-03 15:00 ` Lutz Donnerhacke
2003-11-03 13:54 amado.alves
2003-11-03 15:44 amado.alves
2003-11-03 22:12 ` Dmytry Lavrov
2003-11-03 22:27 ` Gautier Write-only
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox