title: Thymeleaf counter variable not incrementing
body: <p>I want to have a counter variable of type integer while rendering my html using thymeleaf but the counter variable is incremented unexpectedly. Below is my code. Please help.</p>
  
  
  
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns:th="http://www.thymeleaf.org" lang="en"
        xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Title&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div th:with="mycounter = 0"&gt;
      &lt;div th:with="mycounter=${mycounter + 1}"&gt;
          &lt;span th:text="${mycounter}"&gt;&lt;/span&gt; &lt;!-- result: 1 --&gt;
      &lt;/div&gt;
      &lt;div th:with="mycounter=${mycounter + 1}"&gt;
          &lt;span th:text="${mycounter}"&gt;&lt;/span&gt; &lt;!-- result: 1 , expected: 2--&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>