Syntax
The syntax is the "set of language rules" used for programming. By language rules we mean the code that is used by the Silverfin templating language. The syntax shows the way code is structured in Silverfin.
Content
Name | Use | Symbol |
---|---|---|
* Plain text | Used to present text without formatting or logic | |
* Print syntax | Used to print out the value of a variable | {{ ... }} |
* Logic syntax | Used to create logic and control flow | {% ... %} |
* Style syntax | Used to format your printed text |
Plain text
Typing a word or sentence in the Silverfin templating editor will just output that word or sentence as a result.
General meeting
Print syntax
If you want to print a variable, you should use the print syntax
{{ variable }}
.
In a variable we store a value. For example, when calculating the profit in a file for a specific period, you store the end result of this calculation in a variable. To then display the profit you have calculated in a template, you need to print this variable.
Let's assume that the variable profit contains the value 999,99
{{ profit }}
Logic syntax
All logic within the Silverfin templating language should be embedded in logic tags {% logic %}
.
Logic tags are the programming logic that tells templates what to do. To find out more about the logic that you can include in the code, please see the following page: Tags
Let's assume that the variable profit contains the value 999,99
{% if profit >= 0 %}
You made a profit of {{ profit }}
{% else %}
You made a loss of {{ profit }}
{% endif %}
Style syntax
Next to the basic style components in Silverfin, there are also some styling properties that need a style syntax. The style defines the format of your printed text. For more information please see styling section.
Updated almost 2 years ago