FUNCTION blocks

A FUNCTION block defines a named procedure with a set of statements.

Syntax

[PUBLIC|PRIVATE] FUNCTION function-name ( [ argument [,...]] )
    [ declaration [...] ]
    [ statement [...] ]
    [ return-clause ]
END FUNCTION
where return-clause is:
RETURN expression [,...]
  1. function-name is the function identifier.
  2. argument is the name of a formal argument of the function.
  3. declaration is a DEFINE, CONSTANT or TYPE instruction.
  4. statement is any instruction supported by the language.