Answers.Body: <p>There's an easier way... Twig has a built-in variable in for-loops called <code>loop</code>, which has <code>loop.index</code> and <code>loop.index0</code> properties which output exactly what you're looking for:</p>
  <p><a href="https://twig.symfony.com/doc/3.x/tags/for.html#the-loop-variable" rel="nofollow noreferrer">https://twig.symfony.com/doc/3.x/tags/for.html#the-loop-variable</a></p>
  <pre><code>{% for project in sliderWork %}
     &lt;div class=&quot;progress__wrap&quot;&gt;
     &lt;span data-slick-index=&quot;{{ loop.index0 }}&quot; class=&quot;progressBar&quot;&gt;&lt;/span&gt;
       &lt;p&gt;&lt;i class=&quot;number&quot;&gt;{{ loop.index }}&lt;/i&gt;{{project.title}&lt;/p&gt;
     &lt;/div&gt;
   {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-02T21:56:02.500Z
Answers.Text: That's great. Thanks James, that's much easier
Answers.UserDisplayName: Adam
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-04T04:49:33.990Z
Answers.Text: @Adam any chance you could mark this as the accepted answer? Thanks!
Answers.UserDisplayName: Jalen Davenport
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-04T13:01:37.660Z
Answers.Text: No problem. Done
Answers.UserDisplayName: Adam
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-02T20:43:10.890Z
Answers.LastActivityDate: 2020-09-03T08:20:46.637Z
Answers.LastEditDate: 2020-09-03T08:20:46.637Z
Answers.UserDisplayName: James Smith
Answers.Body: <p>I have managed to figure it out. I will use the following and it seems to work fine</p>
  <pre><code>{% set indexCounter = ( counter | default(0) ) %}
  
  {% set counter = ( counter | default(0) ) + 1 %}
  </code></pre>
  <p>Hope this can be of help to someone.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-02T19:23:13.193Z
Answers.LastActivityDate: 2020-09-02T19:23:13.193Z
Answers.UserDisplayName: Adam
Body: <p>I currently have an entries field which outputs a list of related entries on page. I'm trying to find a way to display two values for these entries.</p>
  <p>The first would be a zero index. I'm trying to assign each entry to link up with a slider. Long story short, each of the 4 assigned entries would be listed as such</p>
  <p>0 Entry One</p>
  <p>1 Entry Two</p>
  <p>2 Entry Three</p>
  <p>3 Entry Four</p>
  <p>The second would be to display a simple count of sorts before each entry. This would be displayed as</p>
  <ol>
  <li>Entry One</li>
  <li>Entry Two</li>
  <li>Entry Three</li>
  <li>Entry Four</li>
  </ol>
  <p>I'm sure this must be possible but I'm unsure about the zero based index format. If anyone could help, I'd really appreciate it.</p>
  <p>My code is currently set up as such</p>
  <pre><code>{% for project in sliderWork %}
     &lt;div class=&quot;progress__wrap&quot;&gt;
     &lt;span data-slick-index=&quot;This is where the zero based index would be displayed&quot; class=&quot;progressBar&quot;&gt;&lt;/span&gt;
       &lt;p&gt;&lt;i class=&quot;number&quot;&gt;This is where the simple numbering would be displayed&lt;/i&gt;{{project.title}&lt;/p&gt;
     &lt;/div&gt;
   {% endfor %}
  </code></pre>
  
Tags: <craft3><entries><ordering><index><number>
Title: Getting an zero index and count for an entry list
ThreadText: # Getting an zero index and count for an entry list
  
  (Asked by: username_0 on 2020-09-02)
  
  I currently have an entries field which outputs a list of related entries on page. I'm trying to find a way to display two values for these entries.
  
  The first would be a zero index. I'm trying to assign each entry to link up with a slider. Long story short, each of the 4 assigned entries would be listed as such
  
  0 Entry One
  
  1 Entry Two
  
  2 Entry Three
  
  3 Entry Four
  
  The second would be to display a simple count of sorts before each entry. This would be displayed as
  
  1. Entry One
  2. Entry Two
  3. Entry Three
  4. Entry Four
  
  I'm sure this must be possible but I'm unsure about the zero based index format. If anyone could help, I'd really appreciate it.
  
  My code is currently set up as such
  
  ```
  {% for project in sliderWork %}
     <div class="progress__wrap">
     <span data-slick-index="This is where the zero based index would be displayed" class="progressBar"></span>
       <p><i class="number">This is where the simple numbering would be displayed</i>{{project.title}</p>
     </div>
   {% endfor %}
  
  ```
  
  **Tags:** craft3, entries, ordering, index, number
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-09-02. Score: 2 | Accepted answer
  
  There's an easier way... Twig has a built-in variable in for-loops called `loop`, which has `loop.index` and `loop.index0` properties which output exactly what you're looking for:
  
  <https://twig.symfony.com/doc/3.x/tags/for.html#the-loop-variable>
  
  ```
  {% for project in sliderWork %}
     <div class="progress__wrap">
     <span data-slick-index="{{ loop.index0 }}" class="progressBar"></span>
       <p><i class="number">{{ loop.index }}</i>{{project.title}</p>
     </div>
   {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: That's great. Thanks username_1, that's much easier  
  > **username_2**: @username_0 any chance you could mark this as the accepted answer? Thanks!  
  > **username_0**: No problem. Done  
  
  ---
  
  ### Answer by username_0 on 2020-09-02. Score: 1
  
  I have managed to figure it out. I will use the following and it seems to work fine
  
  ```
  {% set indexCounter = ( counter | default(0) ) %}
  
  {% set counter = ( counter | default(0) ) + 1 %}
  
  ```
  
  Hope this can be of help to someone.
  
  
  ---
  
  