Assigns the value of an expression, as assign does: later Liquid and expressions read it, a for doesn’t hide it, a partial doesn’t see it. Liquid filters may follow the expression.
Takes
What it is
namerequired
The variable it assigns.
expressionrequired
Operators + - * / %, comparisons, andornot (or && || !), ? :, and the functions below. Reads any variable of the template.
A condition Liquid can’t read itself is read as an expression, also in elsif and unless; every Liquid condition stays as it was. In an expression 0, empty text, null and false count as false (in Liquid only null and false do). Nothing is smaller or larger than null.
Goes through a list one by one: a list setting (settings.alarms, a device or flow each), a buttons or values setting, any list a widget gets. else shows when the list is empty. Inside, forloop.index counts from 1 (forloop.index0 from 0), forloop.first and forloop.last say where it is, forloop.length how many there are. limit: and offset: take part of it. Outside a loop, list.size is how many, list.first and list.last one of them; an empty list is still true in a Liquid if, so test list.size > 0.
Dates: How long until a time, in seconds, minutes, hours or days, with fractions (negative once passed). A date without a time counts from the start of that day.
Text: A number written with a pattern: zeros for digits always written ('00'), a comma for thousands ('#,##0'), decimals after the point ('0.00'). Null when it isn’t a number.