Types¶
Experience Builder's liquid system contains the following types.
Nil¶
Represents a null or absent value in Experience Builder. It is equivalent to null in many programming languages. This type is typically used to denote an absence of value and does not participate in any meaningful operations.
Example:
Output:Empty¶
Denotes a value that represents "nothing", but different from nil. Commonly used to represent an uninitialized variable.
- Type:
Empty
Example:
Output:Blank¶
Represents a value similar to empty, but generally used with strings and arrays to signify they contain no meaningful data (e.g., an empty string or whitespace).
- Type:
Blank
Example: ```
{{ value | default: 'Default Value' }}
**Output**:
Default Value
```
Array¶
Stores a collection of values.
- Type:
Array
Example:
Output:Boolean¶
Represents true or false states.
- Type:
Boolean
Example:
{% assign condition = true %}
{% if condition %}
The condition is true.
{% else %}
The condition is false.
{% endif %}
Dictionary¶
Key-value pairs collection.
- Type:
Dictionary
Example:
Output:Number¶
Represents numeric values.
- Type:
Number
Example:
Output:String¶
Textual data.
- Type:
String
Example:
Output:DateTime¶
Represents date and time values.
- Type:
DateTime
Example:
Output:Key Points¶
- Boolean Aliases: The types
Blank,Empty, andFalsebehave similarly when evaluated in conditional checks. - Array Indexing: Accessing array items out of bounds returns
Nil. - Dictionary Default Values: Attempting to access non-existent keys in a dictionary will return
Nil. - DateTime Formatting: Provides powerful manipulation and formatting capabilities using Liquid filters.
- Type Conversion: Implicit conversion happens in complex operations, like adding
NumberandStringtypes leading ultimately to aString. - Outliers: Particular attention needs to be given to
NilandEmptyas they can affect logical operations heavily due to their inherent nature of representing "absence of value." Usage in loops or conditionals may lead to unexpected behaviors, especially in nested constructs.