Is it possible to parse String to liquid variable?

Solved
Highlighted
New Member
4 0 0

Hi

 

I would like to parse String to liquid variable.

 

{% assign  a = "b" %}

{% assign  b = "c" %}

{% assign    c = "d" %}

 

Is it possible to get 'd' by calling 'a'?

 

 

{{ {{ a }} }}

//expected Result: d

//Actual Result : Not working 

 

 

Unfortunately above example is not possible.

Is there any way to  solve this problem?

 

thanks.

 

 

0 Likes

Success.

Excursionist
25 2 4

You're close, just have them in the wrong order, and you only need the quotes around the original string.

{% assign d = "d" %}
{% assign c = d %}
{% assign b = c %}
{% assign a = b %}

<div>d = {{ a }}</div>

 

You can also shorten this to just

{% assign c = "d" %}
{% assign b = c %}
{% assign a = b %}

<div>d = {{ a }}</div>

Depends on exactly what you want, not sure.

 

Hope that helps

0 Likes