You are here: Function Reference > Overview

Overview

Functions and procedures and their and associated parameters must be written in this syntax:

FUNCTION( parameters )

Many functions return a value the script may use in some fashion. For instance, the following statements each use the value returned from a function:

Statement

This statement...

IF (FUNCTION( )) then

...

END

Shows the returned value used in the logical evaluation of the IF statement. If the returned value is non-zero, the IF statement is TRUE. If the value is zero, the IF will evaluate FALSE.

Y = FUNCTION( );

Demonstrates assigning another variable the result returned from a function.

Y = FUNCTION( FUNCTION2( ) );

Is similar to the last, except it also demonstrates the use of a function’s return value as a parameter to another function.

$VAL = 17.00 / FUNCTION( );

Demonstrates the use of a returned value as an operand in a mathematical expression.

Some functions do not return a value and simply perform some operation and return. These types of functions are often referred to as procedures to distinguish them from those functions that do return values. If a function does not return a value, using it in one of the above described manners causes a syntax error.

Sometimes a function may behave as either a function or procedure. For these functions, if they are used in one of the manners shown, a result will be returned. If called in a manner that does not expect a result, none will be returned.

Please note however, for those functions that must return a value, you are required to use the result in one of the above described manners or a syntax error will be generated.

Each function description identifies any required or optional return value.

Note The SAMPCO sample resources contain a great number of DAL examples and explanations. Be sure to check out this resource as you create DAL scripts for your company.