Answers.Body: <p>Yes, you can do the same in Craft using Twig's <a href="http://twig.sensiolabs.org/doc/functions/cycle.html" rel="nofollow">cycle function</a>:</p>
  
  <pre><code>{% set myClasses = ['classOne', 'classTwo', 'classThree'] %}
  
  {% for entry in entries %}
      {{ cycle(myClasses, loop.index0) }}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-21T17:47:49.697Z
Answers.LastActivityDate: 2015-01-21T17:53:39.307Z
Answers.LastEditDate: 2015-01-21T17:53:39.307Z
Answers.UserDisplayName: carlcs
Answers.Body: <p>From the documentation site</p>
  
  <pre><code>{% switch matrixBlock.type %}
  
      {% case "text" %}
  
          {{ matrixBlock.textField | markdown }}
  
      {% case "image" %}
  
          {{ matrixBlock.image[0].getImg() }}
  
      {% default %}
  
          &lt;p&gt;A font walks into a bar.&lt;/p&gt;
          &lt;p&gt;The bartender says, “Hey, we don’t serve your type in here!”&lt;/p&gt;
  
  {% endswitch %}
  </code></pre>
  
  <p><a href="http://buildwithcraft.com/docs/templating/switch" rel="nofollow">http://buildwithcraft.com/docs/templating/switch</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-21T17:50:14.603Z
Answers.Text: Despite the fact that the names are the same, those two functions do very different things. To be fair, EE is grossly misusing the `switch` terminology.
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-21T17:32:59.237Z
Answers.LastActivityDate: 2015-01-21T17:32:59.237Z
Answers.UserDisplayName: magicspon
Body: <p>Does Craft have an answer to ExpressionEngine's <code>{switch}</code> tag?</p>
  
  <pre><code>{switch="classOne|classTwo|classThree"}
  </code></pre>
  
Tags: <templating>
Title: Craft's answer to {switch} from EE
ThreadText: # Craft's answer to {switch} from EE
  
  (Asked by: username_0 on 2015-01-21)
  
  Does Craft have an answer to ExpressionEngine's `{switch}` tag?
  
  ```
  {switch="classOne|classTwo|classThree"}
  
  ```
  
  **Tags:** templating
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-01-21. Score: 5 | Accepted answer
  
  Yes, you can do the same in Craft using Twig's [cycle function](http://twig.sensiolabs.org/doc/functions/cycle.html):
  
  ```
  {% set myClasses = ['classOne', 'classTwo', 'classThree'] %}
  
  {% for entry in entries %}
      {{ cycle(myClasses, loop.index0) }}
  {% endfor %}
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2015-01-21. Score: 0
  
  From the documentation site
  
  ```
  {% switch matrixBlock.type %}
  
      {% case "text" %}
  
          {{ matrixBlock.textField | markdown }}
  
      {% case "image" %}
  
          {{ matrixBlock.image[0].getImg() }}
  
      {% default %}
  
          <p>A font walks into a bar.</p>
          <p>The bartender says, “Hey, we don’t serve your type in here!”</p>
  
  {% endswitch %}
  
  ```
  
  <http://buildwithcraft.com/docs/templating/switch>
  
  > **Comments:**
  > **username_3**: Despite the fact that the names are the same, those two functions do very different things. To be fair, EE is grossly misusing the `switch` terminology.  
  
  ---
  
  