Re: "continue/next" for "loop"

From: Preben Randhol (randhol+valid_for_reply_from_news_at_pvv.org)
Date: 11/03/03


Date: Mon, 3 Nov 2003 10:51:22 +0000 (UTC)

On 2003-11-03, Lutz Donnerhacke <lutz@iks-jena.de> wrote:
> 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;

You cannot do:

         if i mod j != 0 then

            -- code
            Put(i'Img);

         end if;

?

I don't quite understand you wuestion I think.

Preben

-- 
"Saving keystrokes is the job of the text editor, not the programming
 language."


Relevant Pages

  • Re: restart after long time
    ... I enjoyed Pascal programming, disliked the detail of assembly level ... If you want to distribute your program to friends that are clueless about computers and don't have python installed - well, it's feasible, but not as elegant as it would be with a single executable. ... Ruby is a similar language. ...
    (comp.programming)
  • Re: C++ Compiling Problems
    ... However, if you're basically new to programming, your life will probably be ... the original book by the language's creators: ... Brian Kernighan and Dennis Ritchie. ... C is an elegant and ...
    (Fedora)
  • Re: Programming - Where to start
    ... "Just make the coffee, Floyd".) ... programming language to choose, since pretty well everybody has an axe to ... languages section, each book covering a different language. ... Aim to split the books evenly (so don't be too quick to stick it on the ...
    (comp.programming)
  • Re: "continue/next" for "loop"
    ... >> I might be out of coffee, but I do not find an elegant way to skip the rest ... "Saving keystrokes is the job of the text editor, not the programming ...
    (comp.lang.ada)
  • Re: dual use of combo box
    ... Your method IS more elegant -- in the old-time programming sense: ... Roger dot Carlson at Spectrum-Health dot Org ... >>>> records in Edit mode shows the proper field value. ...
    (microsoft.public.access.forms)