Basics
Operators
TODO: gli operatori funzionano sui valori degli endpoint, da verificare sui campi dinamici (dynamicfields.)
Operator | Meaning | Work | Syntax (forse togliamo questa colonna?) |
---|---|---|---|
== | equals | (/) |
|
!= | does not equal | ||
> | greater than | ||
< | less than | ||
>= | greater than or equal to | ||
<= | less than or equal to | ||
or | logical or | ||
and | logical and | ||
contains | checks for the presence of a substring inside a string |
Example
Code Block |
---|
{% if product.title == "Awesome Shoes" %}
These shoes are awesome!
{% endif %} |
Code Block |
---|
{% if product.type == "Shirt" or product.type == "Shoes" %}
This is a shirt or a pair of shoes.
{% endif %} |
Truthy and falsy
TBD
Types
TBD
...
Operator | Meaning | Work | Syntax |
---|---|---|---|
comment | Any text within the opening and closing comment blocks will not be output, and any Liquid code within will not be executed | Yes | {% comment %} Text {% endcomment %} |
...
Operator | Meaning | Work | Syntax |
---|---|---|---|
if | Executes a block of code only if a certain condition is | Yes | {% assign c1 = dynamicfields.name| evaltext: 'equalTo', 'Jennifer' %} {% if c1 == true %} Text {% endif %} |
unless | Executes a block of code only if a certain condition is not me | Yes | {% assign c1 = dynamicfields.name| evaltext: 'equalTo', 'Jennifer' %} {% unless c1 == true %} Text {% endunless %} |
elsif/else | Adds more conditions within an if or unless block. | ||
case/when | Creates a switch statement to compare a variable with different values |
Iteration
TBD
Variable
TBD
...
Operator | Meaning | Work | Syntax |
---|---|---|---|
append | yes | {{ "Hello " | append: "Carl" }} {% assign c1 = dynamicfields.name %} {{ "Hello" | append: c1 }} {{ "Hello " | append: dynamicfields.name }} | |
upcase | Makes each character in a string uppercase. It has no effect on strings which are already all uppercase. | Yes | {{ dynamicfields.name | upcase }} |
...