Answers.Body: <p>You can concatenate variables like this:</p>
  
  <pre><code>{% set foo = 'foo' %}
  {% set bar = 'bar' %}
  {% set foobar = 'Hello' ~ foo ~ bar %}
  {{ foobar }} #Outputs Hello foobar
  </code></pre>
  
  <p>It's explained by Brandon <a href="https://github.com/brandonkelly/TwigForDesigners/blob/master/values-expressions-and-variables.md#expressions" rel="nofollow">here</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-12T10:46:49.743Z
Answers.Text: Perfect thanks! Thank you for the resource too, very helpful!
Answers.UserDisplayName: JRW
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-12T10:42:13.907Z
Answers.LastActivityDate: 2015-10-12T10:47:24.520Z
Answers.LastEditDate: 2015-10-12T10:47:24.520Z
Answers.UserDisplayName: Paul
Body: <p>How can I create a variable that is a combination of two variables with text?</p>
  
  <p>For example, I know the following is wrong but is something like this possible:</p>
  
  <pre><code>{% set foo = 'foo' %}
  {% set bar = 'bar' %}
  {% set foobar = 'Hello' foo,bar %}
  {{ foobar }} #Outputs Hello foobar
  </code></pre>
  
Tags: <variable><set>
Title: Combine variables with text to make variable
ThreadText: # Combine variables with text to make variable
  
  (Asked by: username_0 on 2015-10-12)
  
  How can I create a variable that is a combination of two variables with text?
  
  For example, I know the following is wrong but is something like this possible:
  
  ```
  {% set foo = 'foo' %}
  {% set bar = 'bar' %}
  {% set foobar = 'Hello' foo,bar %}
  {{ foobar }} #Outputs Hello foobar
  
  ```
  
  **Tags:** variable, set
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-10-12. Score: 2 | Accepted answer
  
  You can concatenate variables like this:
  
  ```
  {% set foo = 'foo' %}
  {% set bar = 'bar' %}
  {% set foobar = 'Hello' ~ foo ~ bar %}
  {{ foobar }} #Outputs Hello foobar
  
  ```
  
  It's explained by Brandon [here](https://github.com/brandonkelly/TwigForDesigners/blob/master/values-expressions-and-variables.md#expressions).
  
  > **Comments:**
  > **username_0**: Perfect thanks! Thank you for the resource too, very helpful!  
  
  ---
  
  