In addition to the name, your custom function can have several parameters. You can add as many parameters as your function will require. For example:
FUNCTION("my_function","number_1","number_2")
Parameters must be expressed as strings, but they need not refer to strings. You can use the parameter names to reflect the type of data your function expects to be given for these parameters.
The types of data which can be used in custom functions are the same as those which appear throughout Fireworkz, as yielded by the TYPE
function:
array |
array or range |
date |
dates and/or times |
error |
errors |
number |
numbers |
reference |
cell references |
text |
text |
You may specify the type of data a parameter must have by appending one of the above names, preceded by a colon, to the parameter name.
For example:
FUNCTION("adding", "first:number", "second:number")
specifies a function called adding
, which has two parameters, first
and second
, which must be numbers.
If you don't specify a type, Fireworkz permits the function to accept numbers, text and dates as parameters.
If you pass an array to a custom function which has no parameters set as arrays, Fireworkz will perform automatic array processing.
In the tangent example, the parameter angle
is specified as requiring a number, so it is named in the function statement as
"angle:number"
To call the parameters you have specified in the FUNCTION
definition from within the function, you should precede their names with an @
character. So, for example, you would have
FUNCTION("adding","one:number","two:number")
@one+@two