Liquid
<h4>An empty string is truthy, so don't do this.</h4>
{% if settings.some_text %}
Some text: “{{ settings.some_text }}”<br>
{% endif %}
<h4>An empty string is truthy, so compare to blank.</h4>
{% assign my_variable = '' %}
{% unless my_variable == blank %}
my_variable: “{{ my_variable }}”<br>
{% endunless %}
{% assign my_variable = 'Some text' %}
{% unless my_variable == blank %}
my_variable: “{{ my_variable }}”<br>
{% endunless %}
<h4>An undefined variable is falsy, but avoid using undefined variables in conditionals.</h4>
{% unless my_other_variable %}
my_other_variable has never been defined<br>
{% endunless %}
<h4>A resource that is hidden or does not exist is truthy, so don't do this</h4>
{% if collections['some-handle'] %}
Title of collection is “{{ collections['some-handle'].title }}”<br>
{% endif %}
Output
An empty string is truthy, so don't do this.
Some text: “”
An empty string is truthy, so compare to blank.
my_variable: “Some text”
An undefined variable is falsy, but avoid using undefined variables in conditionals.
my_other_variable has never been defined
A resource that is hidden or does not exist is truthy, so don't do this
Title of collection is “”