Answers.Body: <p>Try doing something like:</p>
  
  <pre><code>{% set nextBlock = block.getNext() %}
  </code></pre>
  
  <p><a href="https://craftcms.com/docs/templating/matrixblockmodel#getNext" rel="nofollow noreferrer">https://craftcms.com/docs/templating/matrixblockmodel#getNext</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-31T14:44:38.393Z
Answers.LastActivityDate: 2017-12-31T14:44:38.393Z
Answers.UserDisplayName: andrew.welch
Body: <p>I’m struggling with getting the next <code>block</code> inside of a loop of a Matrix-Field. I’ve tried this:</p>
  
  <pre><code>{% set nextBlock = entry.articleContent.offset(1).limit(1) %}
  {% if nextBlock.type == "textBox" %}
   {{ nextBlock.textTitle }}
  {% endif %}
  </code></pre>
  
  <p>This produces an <strong>ArgumentCountError</strong>. Can someone help me with this issue?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-31T14:45:09.163Z
Comments.Text: Your `nextBlock` is currently an object of type `ElementCriteriaModel` so you have a query but you don't use it. In order to execute the search you need to use the `first()` function. Or you could use the `block.getNext()` function
Comments.UserDisplayName: Robin Schambach
Tags: <matrix><forloop><loop><previous-next>
Title: Next block inside of a loop
ThreadText: # Next block inside of a loop
  
  (Asked by: username_0 on 2017-12-31)
  
  I’m struggling with getting the next `block` inside of a loop of a Matrix-Field. I’ve tried this:
  
  ```
  {% set nextBlock = entry.articleContent.offset(1).limit(1) %}
  {% if nextBlock.type == "textBox" %}
   {{ nextBlock.textTitle }}
  {% endif %}
  
  ```
  
  This produces an **ArgumentCountError**. Can someone help me with this issue?
  
  **Tags:** matrix, forloop, loop, previous-next
  
  > **Comments:**
  > **username_1**: Your `nextBlock` is currently an object of type `ElementCriteriaModel` so you have a query but you don't use it. In order to execute the search you need to use the `first()` function. Or you could use the `block.getNext()` function  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-12-31. Score: 4 | Accepted answer
  
  Try doing something like:
  
  ```
  {% set nextBlock = block.getNext() %}
  
  ```
  
  <https://craftcms.com/docs/templating/matrixblockmodel#getNext>
  
  
  ---
  
  