Functions allow using a certain fragment of the code multiple times without describing it again. Declare the function (i.e. describe a fragment of code) only once and then call the function by its name.
The rusdate function is described in the built-in template. The code of this function changes the numerical value of a month into a character value:
This function is called in several sections of the template:
Describing a custom function
As an example, let's create a function to say thank you to customers who make an order for more than 1 000 euro. The function code:
After you have added the function, add its call into the description of the string "Total":
After the invoice template code is changed, the document will show different information depending on the order amount.