Writing and naming a function does not actually allow it to run.  All functions need to be enveloped in a script wrapper or envelope, within a special procedure name that is recognised by Statelake.  Please refer to What Is A Procedure for more information.

Functions are called in a statement block between a begin and end statement.  

You use a function within your script simply by entering its name and providing the appropriate parameters (or arguments) - this is known as a function call.   

A function is activated by the evaluation of an expression that contains its call, and returns a value to that expression.   

The following example calls the function IntToStr and passes in a single parameter contained in MyFloatVariable, assigning the result to the variable called Value.

Value := IntToStr(MyFloatVariable);

When calling a function that has multiple parameters, these parameters are separated by a comma such as in this call below – the function TaxAmount passes in two parameters (the value in the variable MyTotalVariable and the value of 12.75).  The result is returned to the variable called Value.

Value := TaxAmount(MyTotalVariable,12.75);

Normally a function is used on the right-hand side of an assignment operator :=.  This assigns the result of the function to the variable on the left of the assignment operator.