title: Appending a text to a variable in Twig
body: <p>I am trying to concatenate a string in Twig using the ~ (tilde) operator. Here is my case, with the different things I tried :</p>
  
  <pre><code>{% set class = 'original_text' %}
  
  {# First try : the most obvious for me, as a PHP dev #}
  {% class ~= 'some_other_text' %}
  
  {# Second try #}
  {% class = class ~ 'some_other_text' %}
  
  {# Third try #}
  {% class = [class, 'some_other_text'] | join(' ') %}
  
  {# Fourth try : the existing variable is replaced #}
  {% set class = [class, 'some_other_text'] | join(' ') %}
  
  {# 
      Then do another bunch of concatenations.....
  #}
  </code></pre>
  
  <p>None of the above work.</p>
  
  <p>I have some more conditions and need to add some text each time. Something that would work like this :</p>
  
  <pre><code>{% set class = 'original_text ' %}
  
  {% class ~= 'first_append ' %}
  {% class ~= 'second_append ' %}
  {% class ~= 'third_append ' %}
  </code></pre>
  
  <p>And the result for</p>
  
  <pre><code>{{ class }}
  </code></pre>
  
  <p>would be :</p>
  
  <pre><code>original_text first_append second_append third_append
  </code></pre>
  
  <p>Any idea on how to do this ?</p>
  
  <p>Thank you !</p>
  
  <p><strong>EDIT :</strong> It turned out to be a CSS error, the concatenation went well....</p>