Skip to main content

Functions

Functions are used to make parts of the code reusable and thereby provide an overarching structure for the code. If you complete a function block, a new block will appear in the Functions menu with the same name as this function block. Now, it is possible to simply insert the block with the name of the function in the main program. When the program is run, this block will lead to the code in the function of the same name, and process this code.

Simple function

The simple function block can be used to create a function bearing the name entered in the text field. This function can contain as many variables as desired, which are added using the gear symbol. This function aging adds 1 to the variable age:

Bild1_e.PNG

The function can then be used in the main program:

Bild2_e.PNG

Function with return value

This block makes it possible to create a function with return value. The return value can then be used in the main program. Here is an example:

Bild3_e.PNG