From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,132a17fa42920218 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!cyclone1.gnilink.net!spamkiller.gnilink.net!gnilink.net!nwrddc03.gnilink.net.POSTED!40f7026d!not-for-mail From: Puckdropper User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040616 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: procedures and return References: <412052f5$1@dnews.tpgi.com.au> In-Reply-To: <412052f5$1@dnews.tpgi.com.au> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Mon, 16 Aug 2004 06:48:01 GMT NNTP-Posting-Host: 4.10.99.30 X-Complaints-To: abuse@verizon.net X-Trace: nwrddc03.gnilink.net 1092638881 4.10.99.30 (Mon, 16 Aug 2004 02:48:01 EDT) NNTP-Posting-Date: Mon, 16 Aug 2004 02:48:01 EDT Xref: g2news1.google.com comp.lang.ada:2748 Date: 2004-08-16T06:48:01+00:00 List-Id: zork wrote: > Hi, > > I am a little confused about how precedures handle a 'return' statement. I > have the following: > > procedure my_procedure (...) > begin > if 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"? > > I am using ada95. > > Any help appreciated! > > zork > > I'm just a beginner, but it would seem what you want to do could be (and is more easily accomplished by) using an if...then...else statement. ---Code:--- procedure my_procedure (...) begin if then put("inside if-statement); new_line; else Ada.Text_IO.put("outside if-statement"); end if; end my_procedure; ---end code--- Puckdropper -- www.uncreativelabs.net Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had. To email me directly, send a message to puckdropper (at) fastmail.fm