Task

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




' Return multiple values
RECORD multi
    LOCAL num
    LOCAL s$[2]
END RECORD
 
FUNCTION f(n) TYPE multi_type
    LOCAL r = { 0 } TYPE multi_type
    r.num = n
    r.s$[0] = "Hitchhiker's Guide"
    r.s$[1] = "Douglas Adams"
    RETURN r
END FUNCTION
 
DECLARE rec TYPE multi_type
rec = f(42)
PRINT rec.num
PRINT rec.s$[0]
PRINT rec.s$[1]