RETURN
Description
Stops the execution of a script or function immediately.
Syntax
1 |
RETURN { <span>expression</span> } |
Parameter |
Description |
---|---|
expression |
In a function, any value (or expression) |
Usage
When a user’s action triggers an event and PowerBuilder
encounters RETURN in the event script, it terminates
execution of that script immediately and waits for the next user
action.
When a script calls a function or event and PowerBuilder encounters RETURN in
the code, RETURN transfers (returns) control
to the point at which the function or event was called.
Examples
This script causes the system to beep once; the second beep statement
will not execute:
1 |
Beep(1) |
1 |
RETURN |
1 |
Beep(1) // This statement will not execute. |
These statements in a user-defined function return the result
of dividing Arg1 by Arg2 if Arg2 is
not equal to zero; they return -1 if Arg2 is equal
to zero:
1 |
IF Arg2 <> 0 THEN<br>   RETURN Arg1/Arg2<br>ELSE<br>   RETURN -1<br>END IF |