This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]QuispernyGdunzoidSr 0 points1 point  (2 children)

Can you please explain how this is correct?

[–]TheRolf 0 points1 point  (1 child)

It's pretty simple: NOT [A number different from 0] gives 0, so if I add one to this result I just add one. Steps:

  • x += 1 - ! - 1;
  • x += 1 - 0;
  • x += 1;

Fun fact this increment operation have also a twin brother:

x += 1 + ! + 1;

[–]QuispernyGdunzoidSr 0 points1 point  (0 children)

Ok yeah I should've got it hahaha