Types of Data

Most of our variable assignment have been data of type string, a sequence of characters.
{% assign full_name = "Joe Pichardo" %}
There are also different type of numbers you can use as values. You have integers which are whole numbers that can be positive, negative, or zero. There are floats which are decimal numbers that can also be positive and negative. For these type assignments you don't wrap the value in quotes.
{% assign one = 1 %}
{% assign negative_one = -1 %}
{% assign zero = 0 %}
{% assign one_half = 0.5 %}
Boolean is a logic data type that can only have two values: true or false. This type is not wrapped in quotes.
{% assign i_am_true = true %}
{% assign i_am_false = false %}
When you try to render a variable that has not been assigned, nothing will render. This is an example of nil, an empty data type. Since the value does not exist there is no output.
{{ unassigned_value }}
Joe Pichardo | Shopify Developer

About Joe Pichardo

Joe Pichardo is a Shopify Developer creating themes and apps to help other programmers succeed on the ecommerce platform.

Having trouble? Ask for help.