TYL PROGRAMMING LANGUAGE
▶ TYL FUNCTION STRUCTURE
To learn about functions in Tyl, use functions page. Here is a schematic description of function statements in Tyl.
Terminology
Function Signature
There are two types of function signature: Function signature without parameters structure:

[FUNCTION-NAME] [FUNCTION-SYMBOL]

Function signature with parameters structure:

[FUNCTION-NAME] [PARAMETERS-LIST] [FUNCTION-SYMBOL]

The only difference between the two types is that the parameterless function does its activity without need for incoming parameters, so its signature consists only of its name and the function symbol.
If a function has parameters, they will be placed between the name and the function symbol.
Function Statement
There are two types of Tyl function statement: One-line function statement structure:

[FUNCTION-SIGNATURE] [ONE-LINE-STATEMENT]

In this type of function statement, the function signature, along with a one-line statement, are written in one line. This is good for actions that can be folded into one line.

Multi-line function statement structure:

[FUNCTION-SIGNATURE]
[STATEMENT]
[STATEMENT]
[STATEMENT]
...


In this type of function statement, the function signature is written in the first line of the function statement, and its statements are written in the next lines.
It is forbidden to write a function statement inside another function statement, but erroneously, it will be regarded as a new function statement.
Also note that if you mix the two types, Tyl will accept it as a multi-line function statement by prepending the first one-line-statement to its statements list.
And finally, a function statement does not need a statement end symbol.
Function Statements in a Module
As described in program structure page, module (program) structure is composed of two optional sections, the second of them is the module functions section. We describe here an optional module structure.

Functional module structure:

[MODULE-STATEMENTS-SECTION]
 [STATEMENT]
 [STATEMENT]
 ...

[MODULE-FUNCTIONS-SECTION]
 [FIRST-FUNCTION]
 [SECOND-FUNCTION]
 [THIRD-FUNCTION]
 ...



Module functions structure:

[FIRST-FUNCTION-SIGNATURE]
[STATEMENTS-LIST]

[SECOND-FUNCTION-SIGNATURE] [ONE-LINE-STATEMENT]

[THIRD-FUNCTION-SIGNATURE]
[STATEMENTS-LIST]



Full function structure:

[FUNCTION-SIGNATURE-SECTION]
 [FUNCTION-NAME] [PARAMETERS-LIST] [FUNCTION-SYMBOL]

[STATEMENTS-LIST-SECTION]
 [STATEMENT]
 [STATEMENT]
 [STATEMENT]
 ...