RETURN - return from current function

SYNOPSIS

<RETURN [$value]>
or in version 8 and later syntax:
<RETURN [{$value ...}|(SQL-expression)]>


DESCRIPTION
The <RETURN> statement ends the current function, optionally setting the value of $ret to its given argument. It can be used to end a function early when some condition or error is met.

In version 8 and later syntax - i.e. when the syntaxversion pragma (here) is 8 or more - the <RETURN> value can be a SQL expression (if given in parentheses) or multiple values, like a variable assignment. Note that attempting to use the parenthetical SQL-expression syntax in version 7 and earlier may result in a compilation error - or may silently succeed yet be interpreted as a literal "(...)" string, e.g. if no embedded variable parameters.


DIAGNOSTICS
RETURN sets a return value if an argument is given.


EXAMPLE

<A NAME=update user>
  <SQL MAX=1 "select FullName from passwd where User = $user">
  </SQL>
  <IF $loop eq 0>        <!-- no such $user: quit now -->
    <RETURN>
  </IF>
  ... continue to update the user ...
</A>


CAVEATS
The RETURN statement was added in version 2.1.882300000 19971216.


SEE ALSO
BREAK, exit


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.