comp.lang.ada
 help / color / mirror / Atom feed
From: gautier_niouzes@hotmail.com (Gautier)
Subject: Re: procedures and return
Date: 16 Aug 2004 04:03:18 -0700
Date: 2004-08-16T04:03:18-07:00	[thread overview]
Message-ID: <17cd177c.0408160303.6b0a6366@posting.google.com> (raw)
In-Reply-To: 412052f5$1@dnews.tpgi.com.au

zork:

> I am a little confused about how precedures handle a 'return' statement. I
> have the following:
> 
> procedure my_procedure (...)
> begin
>     if <some_condition> then
>         put("inside if-statement);
>         new_line;
>         return;
>     end if;
>     put ("outside if-statement");
> end my_procedure;
> 
> I am finding that if some_condition *is* satisfied, then the procedure
> prints both put statements i.e.
> 
> inside if-statement
> outside if-statement
> 
> ... i thought 'return' should exit the procedure and return control to where
> the procedure was called. hence only printing "inside if-statement"?

Aren't you calling 'my_procedure' twice, once with <some_condition> = True,
then once with <some_condition> = False ?
________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!



      parent reply	other threads:[~2004-08-16 11:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-16  6:23 procedures and return zork
2004-08-16  6:48 ` Puckdropper
2004-08-16  7:10 ` zork
2004-08-16  9:50 ` Georg Bauhaus
2004-08-16 11:03 ` Gautier [this message]
replies disabled

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