Hiya,
So I'm curious if it's possible to access a variables value based on another variables name? The aim is to reduce repeated code.
As an example:
{% assign variable_1 = 'test' %}
{% assign variable_2 = 'test' %}
{% assign variable_3 = 'test' %}
{% for x in (1..3) %}
{% assign myVariable = ['variable_' | append: x] %}
{% endfor %}
I know this is possible for objects e.g.
{% assign product_handle = 'my-product' %}
{% assign myProduct = all_products[product_handle] %}
But what about variables on their own? (Not in an object like my first snippet).
Thanks in Advance,
Ceri.
User | Count |
---|---|
28 | |
17 | |
16 | |
12 | |
12 |