Task

Show how to return more than one value from a function.




 
*!* Return multiple values from a function
*!* The simplest way is to pass the parameters by reference
*!* either by SET UDFPARMS TO REFERENCE, or prefix the variables with @.
LOCAL a, b
a = 5
b = 6
? "Sum =", AddUp(@a, @b)    && Displays 11
? "a =", a, "b =", b        && Displays 4, 5
? "Sum =", AddUp(@a, @b)    && Displays 9
 
FUNCTION AddUp(n1, n2)
LOCAL n 
n = n1 + n2
n1 = n1 - 1
n2 = n2 - 1 
RETURN n
ENDFUNC
 