LoginLogin

Returning arrays with OUT.

Root / Submissions / [.]

12Me21Created:
I used to think it wasn't possible to return arrays with OUT.
DEF TEST OUT ARRAY
 DIM ARRAY[10] 'error: duplicate variable
END
However, all you need to do is use =...
DEF TEST OUT ARRAY
 DIM ARRAY2[10]
 ARRAY=ARRAY2
END
Note that this will not work:
DEF TEST ARRAY
 DIM ARRAY2[0]
 ARRAY=ARRAY2
END
(It would work if ARRAY2 was global or if ARRAY is set using the return of another function)

No posts yet (will you be the first?)