Description
Stops the execution of a script or function immediately.
Syntax
RETURN { expression }
Parameter |
Description |
---|---|
expression |
In a function, any value (or expression) you want the function to return. The return value must be the datatype specified as the return type in the function. |
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
Example 1
This script causes the system to beep once; the second beep statement will not execute:
Beep(1) RETURN Beep(1) // This statement will not execute.
Example 2
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:
IF Arg2 <> 0 THEN RETURN Arg1/Arg2 ELSE RETURN -1 END IF