title: Simple If/Else Razor Syntax
body: <p>I'm trying to do a simple If/Else within a foreach with this code:</p>
  
  <pre><code>@{
  var count = 0;
  foreach (var item in Model)
  {
      if (count++ % 2 == 0)
      {
          @:&lt;tr class="alt-row"&gt;
      } else { 
          @:&lt;tr&gt;
      }
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Title)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.Truncate(item.Details, 75)
          &lt;/td&gt;
          &lt;td&gt;
              &lt;img src="@Url.Content("~/Content/Images/Projects/")@item.Images.Where(i =&gt; i.IsMain == true).Select(i =&gt; i.Name).Single()" 
                  alt="@item.Images.Where(i =&gt; i.IsMain == true).Select(i =&gt; i.AltText).Single()" class="thumb" /&gt;
          &lt;/td&gt;
          &lt;td&gt;
              @Html.ActionLink("Edit", "Edit", new { id=item.ProjectId }) |
              @Html.ActionLink("Details", "Details", new { id = item.ProjectId }) |
              @Html.ActionLink("Delete", "Delete", new { id=item.ProjectId })
          &lt;/td&gt;
      &lt;/tr&gt;
  }
  }
  </code></pre>
  
  <p>I get a parse error "Encountered end tag "tr" with no matching start tag.  Are your start/end tags properly balanced?". Seems like the if statement doesn't wanna' work.</p>