Answers.Body: <p>Your question is rather vaguely but if I'm right:</p>
  
  <p>You could put an "if" statement around your "h1" element like,</p>
  
  <pre><code>{% if loop.first %}&lt;h1&gt;This text will only be used if the lightswitch is active&lt;/h1&gt;{% endif %}
  </code></pre>
  
  <p>Or add a field to the block. Preferably a lightswitch. Which if enabled will show the H1 tag and wont if you dont activate it.</p>
  
  <pre><code>{% if block.lightSwitch %}&lt;h1&gt;This text will only be used in the first loop&lt;/h1&gt;{% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-06T11:22:21.587Z
Answers.Text: Seems like putting my code into {% if loop.first %}{% endif %} makes it just hidden. All I want is to prevent it from being part of the block.
Answers.UserDisplayName: curious
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-06T12:17:48.673Z
Answers.Text: @J.Baptiste Should try the light switch code but can you be more clear with your question?
Answers.UserDisplayName: Justin Dekkers
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-06T12:51:17.663Z
Answers.Text: i just edited first post
Answers.UserDisplayName: curious
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-06T11:03:35.317Z
Answers.LastActivityDate: 2017-02-06T11:03:35.317Z
Answers.UserDisplayName: Justin Dekkers
Body: <p>I fell like I'm missing an obvious thing, how to end block before I will start the new one?</p>
  
  <pre><code>{% for block in entry.myMatrixField %}
  
  {% if block.type == "heading" %}
  
      &lt;h3&gt;{{ block.heading }}&lt;/h3&gt;
      &lt;h1&gt;I don't want this text to be part of heading block&lt;/h1&gt;
  
  {% elseif block.type == "text" %}
  
      {{ block.text|markdown }}
  
  {% endif %}
  
  {% endfor %}
  </code></pre>
  
  <h1>edit: here is my real code:</h1>
  
  <pre><code>{# "Check" section #}
                      &lt;section class="wrapper style1 container special"&gt;
                          &lt;div class="row"&gt;
  {# "Check" block #}
              {% elseif block.type == "check" %}
                              &lt;div class="4u 12u(narrower)"&gt;
                                  &lt;section&gt;
                                      &lt;span class="icon featured fa-check"&gt;&lt;/span&gt;
                                      &lt;header&gt;
                                          &lt;h3&gt;{{ block.checkHeader }}&lt;/h3&gt;
                                      &lt;/header&gt;
                                      &lt;p&gt;{{ block.checkText }}&lt;/p&gt;
                                  &lt;/section&gt;
                              &lt;/div&gt;
  {# In this place block "check" should end #}
                          &lt;/div&gt;
                      &lt;/section&gt;
  {# end of "check" section#}
  
  {#beginning of "gallery section" #}
                          &lt;section class="wrapper style3 container special"&gt;
                          &lt;header class="major"&gt;
                              &lt;h2&gt;Next look at this &lt;strong&gt;cool stuff&lt;/strong&gt;&lt;/h2&gt;
                          &lt;/header&gt;
  
                          &lt;div class="row"&gt;
  {# "gallery" block #}
              {% elseif block.type == "gallery" %}
                              &lt;div class="6u 12u(narrower)"&gt;
  
                                  &lt;section&gt;
                                      &lt;a href="#" class="image featured"&gt;&lt;img src="someimagesoon.jpg" alt="" /&gt;&lt;/a&gt;
                                      &lt;header&gt;
                                          &lt;h3&gt;{{ block.imageHeader }}&lt;/h3&gt;
                                      &lt;/header&gt;
                                      &lt;p&gt;{{ block.imageText }}&lt;/p&gt;
                                  &lt;/section&gt;
  {# In this place block "gallery" should end #}
                              &lt;/div&gt;
                          &lt;/div&gt;
  
                          &lt;footer class="major"&gt;
                              &lt;ul class="buttons"&gt;
                                  &lt;li&gt;&lt;a href="#" class="button"&gt;See More&lt;/a&gt;&lt;/li&gt;
                              &lt;/ul&gt;
                          &lt;/footer&gt;
  
                      &lt;/section&gt;
  
              &lt;/article&gt;
  </code></pre>
  
Tags: <matrix>
Title: How to skip fragments of code in Matrix?
ThreadText: # How to skip fragments of code in Matrix?
  
  (Asked by: username_0 on 2017-02-06)
  
  I fell like I'm missing an obvious thing, how to end block before I will start the new one?
  
  ```
  {% for block in entry.myMatrixField %}
  
  {% if block.type == "heading" %}
  
      <h3>{{ block.heading }}</h3>
      <h1>I don't want this text to be part of heading block</h1>
  
  {% elseif block.type == "text" %}
  
      {{ block.text|markdown }}
  
  {% endif %}
  
  {% endfor %}
  
  ```
  
  # edit: here is my real code:
  
  ```
  {# "Check" section #}
                      <section class="wrapper style1 container special">
                          <div class="row">
  {# "Check" block #}
              {% elseif block.type == "check" %}
                              <div class="4u 12u(narrower)">
                                  <section>
                                      <span class="icon featured fa-check"></span>
                                      <header>
                                          <h3>{{ block.checkHeader }}</h3>
                                      </header>
                                      <p>{{ block.checkText }}</p>
                                  </section>
                              </div>
  {# In this place block "check" should end #}
                          </div>
                      </section>
  {# end of "check" section#}
  
  {#beginning of "gallery section" #}
                          <section class="wrapper style3 container special">
                          <header class="major">
                              <h2>Next look at this <strong>cool stuff</strong></h2>
                          </header>
  
                          <div class="row">
  {# "gallery" block #}
              {% elseif block.type == "gallery" %}
                              <div class="6u 12u(narrower)">
  
                                  <section>
                                      <a href="#" class="image featured"><img src="someimagesoon.jpg" alt="" /></a>
                                      <header>
                                          <h3>{{ block.imageHeader }}</h3>
                                      </header>
                                      <p>{{ block.imageText }}</p>
                                  </section>
  {# In this place block "gallery" should end #}
                              </div>
                          </div>
  
                          <footer class="major">
                              <ul class="buttons">
                                  <li><a href="#" class="button">See More</a></li>
                              </ul>
                          </footer>
  
                      </section>
  
              </article>
  
  ```
  
  **Tags:** matrix
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-02-06. Score: 1
  
  Your question is rather vaguely but if I'm right:
  
  You could put an "if" statement around your "h1" element like,
  
  ```
  {% if loop.first %}<h1>This text will only be used if the lightswitch is active</h1>{% endif %}
  
  ```
  
  Or add a field to the block. Preferably a lightswitch. Which if enabled will show the H1 tag and wont if you dont activate it.
  
  ```
  {% if block.lightSwitch %}<h1>This text will only be used in the first loop</h1>{% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Seems like putting my code into {% if loop.first %}{% endif %} makes it just hidden. All I want is to prevent it from being part of the block.  
  > **username_1**: @J.Baptiste Should try the light switch code but can you be more clear with your question?  
  > **username_0**: i just edited first post  
  
  ---
  
  