Help us understand the problem. What is going on with this article?

i++と++iの違い

More than 3 years have passed since last update.

++iは返り値としてインクリメント後の値を返す

 i = 1;
 j = ++i;
 (i is 2, j is 2)

i++は返り値としてインクリメント前の値を返す

 i = 1;
 j = i++;
 (i is 2, j is 1)

参考: What is the difference between ++i and i++

finc
健康寿命を伸ばすアプリFiNCの開発・運営を行うモバイルヘルステクノロジーベンチャー
https://finc.com
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away