Answers.Body: <p>To test if the current block is the last in the loop and of a certain type, you could do something like:</p>
  
  <pre><code>{% if loop.last and block.type == "yourBlockType" %}yes{% endif %}
  </code></pre>
  
  <p>or shorthand</p>
  
  <pre><code>{{ loop.last and block.type == "yourBlockType" ? 'yes' : 'no' }}
  </code></pre>
  
  <p>In the above example replace <code>'no'</code> with <code>''</code> to output nothing. It's  just there if you want to output something in case of false</p>
  
  <p>or even shorter</p>
  
  <pre><code>{{ loop.last and block.type == "yourBlockType" ? 'yes' }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-06T14:31:52.033Z
Answers.LastActivityDate: 2017-05-06T15:17:03.793Z
Answers.LastEditDate: 2017-05-06T15:17:03.793Z
Answers.UserDisplayName: AbbeyDesign
Body: <p>What are I doing wrong here?</p>
  
  <p>I'm setting block types 'stripCustom' and 'stripShowroom' to 'stripBlock'</p>
  
  <pre><code>{% set stripBlock = entry.contentImage.type(['stripCustom', 'stripShowroom']) %}
  </code></pre>
  
  <p>Then in a loop checking if 'stripBlock' is last and the current block is last but one.</p>
  
  <pre><code>&lt;div class="section {% if loop.last == stripBlock and loop.revindex0 == 1 %}gutter-bottom--double{% endif %}"&gt;
  ....
  &lt;/div&gt;
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-05T16:02:28.070Z
Comments.Text: I don't think you can compare loop.last to your stripBlock variable. I think loop.last just is or isn't.
Comments.UserDisplayName: AbbeyDesign
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-06T07:21:56.457Z
Comments.Text: Oh. So is there a way to test is a certain block type is last?
Comments.UserDisplayName: sarah3585
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-10T16:44:49.510Z
Comments.Text: Did my answer below help you with your issue?
Comments.UserDisplayName: AbbeyDesign
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-11T09:38:49.177Z
Comments.Text: Haven't had a chance to look yet as I've been pulled away from that project, I will look today.
Comments.UserDisplayName: sarah3585
Tags: <matrix><loop><block-types>
Title: loop.last of a certain block type
ThreadText: # loop.last of a certain block type
  
  (Asked by: username_0 on 2017-05-05)
  
  What are I doing wrong here?
  
  I'm setting block types 'stripCustom' and 'stripShowroom' to 'stripBlock'
  
  ```
  {% set stripBlock = entry.contentImage.type(['stripCustom', 'stripShowroom']) %}
  
  ```
  
  Then in a loop checking if 'stripBlock' is last and the current block is last but one.
  
  ```
  <div class="section {% if loop.last == stripBlock and loop.revindex0 == 1 %}gutter-bottom--double{% endif %}">
  ....
  </div>
  
  ```
  
  **Tags:** matrix, loop, block-types
  
  > **Comments:**
  > **username_1**: I don't think you can compare loop.last to your stripBlock variable. I think loop.last just is or isn't.  
  > **username_0**: Oh. So is there a way to test is a certain block type is last?  
  > **username_1**: Did my answer below help you with your issue?  
  > **username_0**: Haven't had a chance to look yet as I've been pulled away from that project, I will look today.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-05-06. Score: 2
  
  To test if the current block is the last in the loop and of a certain type, you could do something like:
  
  ```
  {% if loop.last and block.type == "yourBlockType" %}yes{% endif %}
  
  ```
  
  or shorthand
  
  ```
  {{ loop.last and block.type == "yourBlockType" ? 'yes' : 'no' }}
  
  ```
  
  In the above example replace `'no'` with `''` to output nothing. It's just there if you want to output something in case of false
  
  or even shorter
  
  ```
  {{ loop.last and block.type == "yourBlockType" ? 'yes' }}
  
  ```
  
  
  ---
  
  