#4752·Twig

Add support for +=, -=, ~= ...

Author: rgpublicCreated Jan 26, 2026Updated Jan 26, 2026

It would be really nice if we could increment, decrement and append strings just by saying

{% set dummy=1 %}
{% set dummy+=1 %}

or

{% set dummy="foo" %}
{% set dummy~="bar %}

Otherwise we always need to write dummy=dummy+=1 which is repetitive. I think the syntax above would be very idiomatic because it exists in PHP and comes naturally.