Answers.Body: <pre><code>{% for type in entry.buildType %}
  {{ type }}
  {% if not loop.last %}/{% endif %}
  {% endfor %}
  </code></pre>
  
  <p>See: <a href="https://twig.symfony.com/doc/2.x/tags/for.html#the-loop-variable" rel="nofollow noreferrer">https://twig.symfony.com/doc/2.x/tags/for.html#the-loop-variable</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-23T06:32:23.483Z
Answers.LastActivityDate: 2018-07-23T06:52:09.647Z
Answers.LastEditDate: 2018-07-23T06:52:09.647Z
Answers.UserDisplayName: Luke Holder
Body: <p>I need to add a separator if there are a multiple of types. How can this be done in a for loop? </p>
  
  <pre><code>{% for type in entry.buildType %}{{ type }}{% endfor %}
  </code></pre>
  
  <p>The outcome is similar to a breadcrumb nav, with an added "/", however the separator should only be placed in between - not for the last.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-23T10:29:31.180Z
Comments.Text: Twig also has a very useful [join filter](https://twig.symfony.com/doc/2.x/filters/join.html), which does exactly this.
Comments.UserDisplayName: Jamie Wade
Tags: <conditional><forloop>
Title: Add conditional in a for loop
ThreadText: # Add conditional in a for loop
  
  (Asked by: username_0 on 2018-07-23)
  
  I need to add a separator if there are a multiple of types. How can this be done in a for loop?
  
  ```
  {% for type in entry.buildType %}{{ type }}{% endfor %}
  
  ```
  
  The outcome is similar to a breadcrumb nav, with an added "/", however the separator should only be placed in between - not for the last.
  
  **Tags:** conditional, forloop
  
  > **Comments:**
  > **username_1**: Twig also has a very useful [join filter](https://twig.symfony.com/doc/2.x/filters/join.html), which does exactly this.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-07-23. Score: 3 | Accepted answer
  
  ```
  {% for type in entry.buildType %}
  {{ type }}
  {% if not loop.last %}/{% endif %}
  {% endfor %}
  
  ```
  
  See: <https://twig.symfony.com/doc/2.x/tags/for.html#the-loop-variable>
  
  
  ---
  
  