TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Classic View

Use Monospaced Font
Show HTML Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Pascal Obry <[log in to unmask]>
Thu, 23 Aug 2001 16:16:55 +0200
text/plain (53 lines)
Toshitaka KUMANO writes:
 > > Of course
 > > if is always possible to add a boolean variable and use 'return
 > > ... when'...
 >
 > Sorry. I cannot understand this statement. Could you elaborate ?

I just meant that you can use a boolean to control the return as in:

   declare
      Cond : Boolean;
   begin
      ...

      if A = B then
         ...
         Cond := True;
      else
         ...
         Cond := False;
      end if;

      ...

      return when Cond;
   end;

In this case the fact that there is some code to call before returning is not
a problem...

My point was that the following case is quite common:

   if A = B then
      ...
      return;
   else
      ...
   end if;

But you are right that this is also the case for "exit ... when"...

Pascal.

--

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--|
--| "The best way to travel is by means of imagination"

ATOM RSS1 RSS2