Re: "continue/next" for "loop"
From: Preben Randhol (randhol+valid_for_reply_from_news_at_pvv.org)
Date: 11/03/03
- Next message: Preben Randhol: "Re: "continue/next" for "loop""
- Previous message: Lutz Donnerhacke: ""continue/next" for "loop""
- In reply to: Lutz Donnerhacke: ""continue/next" for "loop""
- Next in thread: Preben Randhol: "Re: "continue/next" for "loop""
- Reply: Preben Randhol: "Re: "continue/next" for "loop""
- Reply: Lutz Donnerhacke: "Re: "continue/next" for "loop""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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."
- Next message: Preben Randhol: "Re: "continue/next" for "loop""
- Previous message: Lutz Donnerhacke: ""continue/next" for "loop""
- In reply to: Lutz Donnerhacke: ""continue/next" for "loop""
- Next in thread: Preben Randhol: "Re: "continue/next" for "loop""
- Reply: Preben Randhol: "Re: "continue/next" for "loop""
- Reply: Lutz Donnerhacke: "Re: "continue/next" for "loop""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|