assign
The assign tag is a native feature of Liquid. In Mechanic-flavored Liquid, the assign tag is extended to support assigning within arrays and hashes.
Assignment into arrays and hashes is always by value, never by reference.
"Assignment by value" means that the result of the assignment will never dynamically change.
At the end of this example, x.foo
still contains "bar"
, even though the value of the original foo
variable has changed.
Assigning into arrays
Arrays support assignment by index, using integer lookups.
Assigning into hashes
Hashes support assignment by key, using string lookups.
Last updated