| ||||||||||||||||||
Function Definition Window
Having clicked with the right mouse button inside the Variables window and
chosen to either edit a function or define a new one, a new window will open to allow you to edit the
definition. The image below shows a new function called julian being defined. (This function
calculates the Julian day number for a given date.) If an existing function was being edited, the upper text
box would show the function's name, but you would not be able to change it.

As shown, the name of the function is entered into the upper text box, and its definition is entered into the lower box. To the left of the equals sign is a list of the parameters that the function will take. To the right of the equals sign is an expression, or a series of expressions, that will be evaluated with the variables named in the parameter list being given the values supplied when the function is used.
For example, after clicking on OK, the function julian will have been defined, and
evaluating julian(today) will convert UltimaCalc's internal representation of today's date into
the Julian Day Number for today.
A more complex example would be the function area with definition:
(a,b,c)=s=(a+b+c); sqrt(s*(s-a)*(s-b)*(s-c))
This function calculates the area of a triangle with
sides a, b,
and c, using another variable s to make
the calculation simpler.
User-defined functions are saved along with user-defined variables and constants in a plain text file.
