Skip to content

Template Else-If and Else Statements

Pre-release
Pre-release
Compare
Choose a tag to compare
@CMEONE CMEONE released this 12 Mar 18:47
· 22 commits to main since this release

Now, you can add more conditionals to templates by using {% elseif(condition) %} and/or {% else %}. Below are some examples:

<p>If statements (using {\% if %}):</p>
<p>If, else if, else if, else</p>
{% if statement == 0 %}
<p>if: 0 (real {{statement}})</p>
{% elseif(statement == 1) %}
<p>elseif: 1 (real {{statement}})</p>
{% elseif (statement == 2) %}
<p>elseif: 2 (real {{statement}})</p>
{% else %}
<p>else: {{ statement }}</p>
{% endif %}
-------------------------------
<p>If, else</p>
{% if statement4 == 0 %}
<p>if: 0 (real {{statement4}})</p>
{% else %}
<p>else: {{ statement4 }}</p>
{% endif %}
-------------------------------
<p>If, else if</p>
{% if statement6 == 8 %}
<p>if: 8 (real {{statement6}})</p>
{% elseif(statement6 == 7) %}
<p>elseif: 7 (real {{statement6}})</p>
{% endif %}