The syntax of the function definition is given below.
function name(arg1,arg2,...) ! ! Optional function description (seen with help("name")) ! import var1,var2 export var3,var4 { expr; ... expr; _name = value }
Functions have their own list of variables. Global variables are not seen in this function unless imported by import or given as arguments. Local variables can be made global by the export statement.
Functions, if returning matrices, behave in many ways as variables do. So if you have defined function mult as follows
function mult(a,b) { _mult = a*b; }
you can get element (3,5) of the a times b matrix by the following statement
mult(x,y)[3,5]
or diagonal values of the same matrix by
diag(mult(x,y)).