comp.lang.ada
 help / color / mirror / Atom feed
From: "Chad R. Meiners" <crmeiners@hotmail.com>
Subject: Re: [ot... well kindof] SDI
Date: Mon, 5 Aug 2002 15:46:14 -0400
Date: 2002-08-05T15:46:14-04:00	[thread overview]
Message-ID: <aimkob$180c$1@msunews.cl.msu.edu> (raw)
In-Reply-To: Ynz39.11$5d3.56@news13-win.server.ntlworld.com

"chris.danx" <spamoff.danx@ntlworld.com> wrote in message
news:Ynz39.11$5d3.56@news13-win.server.ntlworld.com...
>> procedure get_personal_detials (person : out PersonRecord) is
> begin
>     ... -- read person.name and person.address.
>     loop
>        begin
>           put ("enter postcode");
>
>           get_postcode (person.pc);
>           exit;  -- ???
>        exception
>           when Postcode_Error => Put_Line ("Postcode is ill-formed!");
>        end;
>      end loop;
> end get_personal_details
>
>
> My concern is at the line marked "-- ???" the code will just exit the
> begin-end block not the loop, is this correct?  If so a simple revision
> that introduced a flag set after get_postcode would do.

Read the Ada Reference Manual Section 5.7 on Exit Statements.
When in doubt look up the rules of the language ;) or label your loop.
For instance you will find the following nice example in the above section
which I think you'll agree is quite helpful in expressing you intentions
clearly.

Main_Cycle:
 loop
  -- initial statements
  exit Main_Cycle when Found;
  -- final statements
 end loop Main_Cycle;

-CRM





  parent reply	other threads:[~2002-08-05 19:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-04  0:24 [ot... well kindof] SDI chris.danx
2002-08-04 14:16 ` Robert Dewar
2002-08-04 18:19   ` tmoran
2002-08-04 19:08     ` chris.danx
2002-08-04 20:00       ` Chad R. Meiners
2002-08-05 18:22         ` chris.danx
2002-08-05 18:24           ` chris.danx
2002-08-05 19:46           ` Chad R. Meiners [this message]
2002-08-05 22:25             ` chris.danx
2002-08-05 23:17               ` Chad R. Meiners
2002-08-05 23:46                 ` chris.danx
2002-08-05 15:58       ` Stephen Leake
2002-08-05 16:10         ` chris.danx
2002-08-05  1:26     ` Robert Dewar
replies disabled

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