title: What happens here: sum += i++;?
body: <p>I have this simple piece of code but I don't understand this part: <code>sum += i++</code> .</p>
  <pre><code>int num1 = 5;
  int sum = 0;
           
  if (num1 &lt; 100) {
      for (int i = 0; i &lt; num1; i++)
          sum += i++; //?
      System.out.println(&quot;sum = &quot; + sum);
  } else {
      sum = -1;
  }
  System.out.print(sum);  
  </code></pre>
  <p>The result I get is 6 and I don't understand how and why.</p>