The software provides a host of built-in functions that process given arguments in a variety of ways. An expression consisting of a function and its arguments (typically, value expressions) is called a functional expression.
Examples of functional expressions are
$length('Smith') | Evaluates to 5 |
$cos(0) | Evaluates to 1 |
$log10(2*50) | Evaluates to 2 |
$year(19990923) | Evaluates to 1999 |
$maxof($absolute(-10),4+5) | Evaluates to 10 |
Functions are a special class of operator, but they perform much like arithmetic operators; they take one or more given values, perform an operation using those values, and return a result. The value of the result depends on the function.
The function's arguments are similar to the arithmetic operands. Like arithmetic operands, the arguments can consist of literals or value expressions, including other functional and arithmetic expressions as shown in the following example:
$absolute(-7)
The functional expression shown above consists of the argument -7 and the function keyword $absolute. The function $absolute returns the absolute (i.e., unsigned) value of its argument (in this case, 7).
If the argument is a complex expression, the argument is evaluated before the function is applied. For example, in the expression
$absolute(6-11)
the arithmetic expression 6-11 is evaluated first, yielding $absolute(-5). Then the final result (5) is determined.
Functional expressions can act as arguments to other functions. For example, the expression
$toupper($substring('abcdef',2,3))
evaluates to
$toupper('bcd')
which in turn evaluates to
'BCD'
Each function expects arguments of a certain data type; however, the function accepts arguments of any data type and appropriately converts any argument that does not conform to the expected type.
About Data Types