Before you can use a function, you must define it. In Forsta Plus, functions are usually defined in script nodes. The syntax of a function definition is as follows:
function FunctionName(p1 { : type},p2 { : type},...,pn { : type}) : type
{
<statements>
}The function name is used to refer to the function in function calls. The same naming rules apply to function names as to variable names. The convention for function names is to start them with a capital letter, to distinguish them from variable names. The arguments (p1,p2,...) are the names of the variables that receive the values passed to the function. You may define functions without any arguments at all, and functions with a variable number of arguments.
Type annotation on parameters and the function itself (for the return type) is not required in the JScript Engine. With the JavaScript engine, type annotation is not supported at all, and cannot be used.