Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

this is correct. i = 0; i+=i++;

(0) + (0)++ = 0 next time around (1) + (1)++ = 2



Unfortunately this is not correct.

If you run

  for (int x = 0; x < 10; x++)
  {
    i += i++;
    Console.WriteLine(i);
  }
i is always 0.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: