Increment value in twig file
Use this:
{% set myVal = 50 %}
{% for item in items %}
{% set myVal = myVal + 10 %}
{% endfor %}
For declaring, setting values, setting blocks/forms, etc. you must use {% %}
. For output, there is {{ }}
Here is the better way -
{% for item in items %}
{% set counter = ( counter | default(0) ) + 1 %}
<p>{{ counter ~ ' ). ' ~ item.title }}</p>
{% endfor %}
See how the counter is being increased by 1.