From: kanderso@mabillon.ICS.UCI.EDU (Ken Anderson)
Subject: Re: Easy ADA question from a hapless Newbie
Date: 25 Oct 94 21:07:47 GMT
Date: 1994-10-25T21:07:47+00:00 [thread overview]
Message-ID: <9410251405.aa17336@paris.ics.uci.edu> (raw)
In-Reply-To: 38jl8h$rqb@columbia.acc.brad.ac.uk
In comp.lang.ada you write:
Hi Adam,
>Can anyone help me?
I'll give it a shot.
> Is there a way of ending a loop such as a while loop, etc, by jumping to the
> end of that loop. There used to be a command in Pascal that would let you
> do this. I think it was something like stop. I know that halt stopped the
> entire program.
You are looking for the exit statement.
declare
A : INTEGER := 1;
begin
loop
exit when A > 5;
A := A + 1;
end loop;
end;
This code will increment A until it is greater than 5 at which time
it will exit the loop.
Note, the when clause is optional. You could also right.
declare
A : INTEGER := 1;
begin
loop
exit;
A := A + 1;
end loop;
end;
In which case A would never be incremented, although it doesn't make
sense in this code, there are situations where the exit statement
without a when clause is useful.
Hope this helps,
Ken
P.S.
>I'm new to ADA, used to PASCAL.
Just a quick comment, its Ada not ADA. ADA is an acronym like the
American Dental Association.
P.P.S.
One additional comment, not a criticism, but when sending text to a USENET
newsgroup be sure to type a return every 80 or so characters. This helps
those of us who have to read news on a VT100 terminal. :)
--
--------------------------------------------------------------------------------
-Ken Anderson Ken_Anderson@acm.org U.C. Irvine-
- "A knowledge of C is probably better than nothing." -- J.G.P. Barnes -
- Finger kanderso@ics.uci.edu for PGP Public Key -
--------------------------------------------------------------------------------
next prev parent reply other threads:[~1994-10-25 21:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-10-25 19:11 Easy ADA question from a hapless Newbie AJ JONES
1994-10-25 21:07 ` Ken Anderson [this message]
1994-10-25 22:17 ` mcriley on BIX
1994-10-26 3:09 ` Jimmy Fang
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox