how make addition from 2 variable twig?

后端 未结 2 1589
渐次进展
渐次进展 2021-02-07 01:56

Anyone knows how to addition two variable in twig I want to do something like:

{{ var1 }} + {{ var2 }}

2条回答
  •  执笔经年
    2021-02-07 02:18

    Declaration :

    {% set counter = 0 %}
    

    Doing the addition :

    {% set counter = counter + 1 %}
    

    For displaying in twig template :

    {{ counter }}
    

提交回复
热议问题