Programming Guide



return

Exits a JPL procedure

Synopsis

return [retval]

Arguments

retval
The value to return to this procedure's caller, where the data type of retval depends on the procedure definition. Supply either a constant, a variable or an expression that evaluates to a string or numeric value. If no argument is supplied, Panther returns a value of 0 or null string, depending on the procedure's return type.

Description

The return command causes a JPL procedure to exit. Control is returned to the procedure's caller, if any, or to the Panther runtime system.

JPL automatically returns with either 0 or null string to a procedure's caller when it reaches the end of the called module or another proc statement. Use the return statement to exit before the end of a procedure, or to return a value other than zero or the null string.

Example

// Call procedure checknum to evaluate value of num
// field. Based on its value, return an integer that
// determines the next procedure to call
vars ret
ret = checknum()
if ret == 1
call lownum_process()
else if ret == 2
call midnum_process()
else
call hinum_process()

proc checknum()
if num < 0
return 1
if num < 500
return 2

return 3