Re: Hi
- Posted by Irv Mullins <irv at ELLIJAY.COM> Jan 16, 1999
- 544 views
On Sat, 16 Jan 1999 19:46:51 -0500, Ken Furlong <stjohn15 at ENTER.NET> wrote: >Thanks for the message, > >Um, about using the return statment, could I write a procedure and simply put >return( ) on the last line before end procedure and this would return the >program >to the if-then or whatever else that had called it? > You could, but a procedure returns automatically without one: if balance < 0 then Overdrawn() -- after the Overdrawn procedure, execution resumes here --> maybe some other stuff end if It is possible to use a return in a procedure to return early, based on some value: procedure Overdrawn(atom amount) if amount < 10.00 then puts(1,'Your account is slightly overdrawn!') return puts(1,'You are a lot overdrawn!!') end if end procedure but it's not usually a good idea, since the same thing will make more sense as: procedure Overdrawn(atom amount) if amount < 10.00 then puts(1,'Your account.....') elsif amount < 100.00 then put(1,'Way over...') else puts(1,'The sheriff is on his way...') end if end procedure Irv