P. 1


|Views: 443|Likes:
Published by mydeardog

More info:

Published by: mydeardog on Sep 27, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





Fn.def name|name$( {nvar}|{svar}|Array[]|Array$[], ….. {nvar}|{svar}|Array[]|Array$[])

If the function name ends with the $ character then the function will return a string otherwise it will

return a number.

The parameter list can contain as many parameters as needed from zero to dozens. The parameters may

be numeric or string, scalar or array.

The following are all valid:

fn.def pi()

fn.def cut$(a$, left, right)

fn.def sum(a, b, b, d, e, f, g, h, i, j)

fn.def sort(v$[], direction)

Copyright© Paul Laughton, 2011

Page 24


Scalar parameters are of the call by value type. This means that that the calling parameter value will be

copied into the defined parameter variable. Changes made to a function parameter during the execution

of the function will not affect the called parameter’s value.

Array parameters are of the call by reference type. This means that changes made to array elements

during the execution the function will change the calling array’s elements.

Functions may call other functions. A function can even recursively call itself.

All variables within an instantiation of a function are private to that instantiation of the function. A

variable in the main program named v$ is not the same variable v$ within a function. Furthermore, a

variable named v$ in a recursively called function is not the same v$ in the calling function.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->