title: How to add html to the page inside a Razor if statement in a foreach?
body: <p>How can I add html to the page from inside an <code>if()</code> in a <code>@foreach()</code>. I get dont get any specific error it just does not take the second <code>if()</code>. It writes it out like text.</p>
  
  <p>this is what i tried but with no luck</p>
  
  <pre><code>@foreach (var item in Model)
      {
          if (count % 4 == 0 || totaltCount == 1)
          {
          &lt;div class="in-instructor-container"&gt;
              }
              &lt;div class="in-instructor"&gt;
                  &lt;h3&gt;@item.Name&lt;/h3&gt;
                  @item.Information
              &lt;/div&gt;
          if ((count - 1) % 3 == 0 || count == totaltCount) {
          &lt;/div&gt;
          }
  
          count++;
      }
  </code></pre>
  
  <p>my html get like this</p>
  
  <pre><code>        &lt;div class="in-instructor-container"&gt;
              }
              &lt;div class="in-instructor"&gt;
  
                  &lt;h3&gt;Test Person 0&lt;/h3&gt;
                  bla bla bla bla bla bla bla
              &lt;/div&gt;
          if ((count - 1) % 3 == 0 || count == totaltCount) {
          &lt;/div&gt;
  </code></pre>