The difference of use of a procedure or a function is often obvious.
If you need to do something without a return, then a procedure is applicable. If you need a result that a function can give, such as one that returns a square root or a TRUE/FALSE return, you can incorporate this into the command, e.g. PRINT 2 * FN_squareroot(4). However, if the result is not needed to be incorporated, then both can be used:
Code: Select all
sqr = FN_squareroot(4)
PROC_squareroot(sqr)
DEF FN_squareroot(n)
= SQR(n)
DEF PROC_squareroot(RETURN n)
n = SQR(n)
Matt