Functions As Members of an Array Example

Functions can be members of an array.

ASSIGN/ANARRAY=ARRAY(3,FACTORIAL,"Hello World",ADD5)
Assigns ANARRAY to be an array of 4 elements : a number (3), a function (FACTORIAL), a string, ("Hello World"), and a function (Add5).

ASSIGN/V6=ANARRAY[2](4)
The second element of ANARRAY is the function FACTORIAL. The parameter 4 is passed in to this function and the result of 24 is assigned to V6.

ASSIGN/V7=ANARRAY[2](ANARRAY[4](ANARRAY[1]))
From the inside out: The first element of ANARRAY (3) is passed to the function of the fourth array element (Add5). The result, 8, is passed to the function of the second array element (FACTORIAL) and assigned to V7. V7 receives a value of 40320.