1. Question for Robert Craig

Rob, I have been using  *return*  clause not only in functions, but also in proc
edures.
Mainly in recursive routines, and, occasionally, as a shortcut from complicated
elsif
structures. It seems to work, but is it legitimate, or more importantly, is it g
oing to
be ok in future releases of Euphoria? Jiri

new topic     » topic index » view message » categorize

2. Re: Question for Robert Craig

Jiri Babor writes:
> Rob, I have been using  *return*  clause not only in functions, but also in
> procedures.
> Mainly in recursive routines, and, occasionally, as a shortcut from
> complicated elsif
> structures. It seems to work, but is it legitimate, or more importantly,
> is it going to
> be ok in future releases of Euphoria? Jiri

Yes, executing a return statement in a procedure is totally
legitimate. It has been there since day 1, and will
always be there. When you return from a *function* you
must supply a value to return to the caller e.g.

     return 9 * length(x)

but when you return from a *procedure*
you can just say:

     return

Control is passed immediately back to the
caller of the procedure. No value is returned.
Only *functions* return values. In practice it seems
like most procedures terminate by simply reaching
"end procedure", but you can end earlier by executing
*return*.

Regards,
  Rob Craig
  Rapid Deployment Software

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu