Hi, I am trying to literally copy past this example inside a MACRO but it does not work:
{%- set macros = true %}
{%- macro loopexample() %}
{% set dict_var = {'name': 'Cool Product', 'price': '$20', 'size':'XL'} %}
{% for key, val in dict_var.items() %}
{{ key }}: {{ val }}
{% endfor %}
{%- endmacro %}
Hey @igcorreia
So this code does work. See below:
{% set macros = true %}
{% macro demo() %}
{% set dict_var = {'name': 'Cool Product', 'price': '$20', 'size':'XL'} %}
{% for key, val in dict_var.items() %}
{{ key }}: {{ val }}<br>
{% endfor %}
{% endmacro %}
{{ demo() }}
Are you not calling the macro to display it? See:
{{ demo() }}