This page last changed on Sep 30, 2011 by kristin.bradley@involver.com.
Overview
if
if / else should be well known from any imaginable programming language.
SML allows you to write simple expressions in the if or unless (and optionally, elsif and else) clause:
Example
{% if is_page_fan %}
Thanks for being a fan!
{% endif %}
{% if current_locale == 'en_US' %}
Hello
{% elsif current_locale == 'es_MX' %}
Hola
{% endif %}
{% if current_locale == 'en_US' or current_locale == 'en_UK'%}
Greetings
{% endif %}
{% if current_locale != 'en_US' %}
Your locale is not en_US
{% endif %}
{% capture greeting %}Greetings world{% endcapture %}
{% if greeting contains 'world' %}Hello world{% endif %}
|