what is i++ & ++i and if there's other like these please tell me it and their meaning | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

what is i++ & ++i and if there's other like these please tell me it and their meaning

17th Dec 2017, 10:40 PM
كل ما سيفيدك
3 Answers
+ 3
Understandable 👍
13th Jan 2021, 3:41 AM
•Đคяк รтяεคм 𝅘𝅥𝅮 ᴺ•ᵀ•ᴬˢᵘʳᵃᵖᵖᵘˡᶦ
•Đคяк รтяεคм 𝅘𝅥𝅮 ᴺ•ᵀ•ᴬˢᵘʳᵃᵖᵖᵘˡᶦ - avatar
+ 2
these are called postfix and prefix. I = your variable. ++ add to. when it says I++ that means it runs the code and then adds 1 to that variable. that's postfix. when it says ++I it adds 1 to the variable and then runs the code. that's prefix.
17th Dec 2017, 10:51 PM
Lysis
Lysis - avatar
+ 2
For example, we have a variable X = 3 and call function value(X). In case postfix ( value(X++)) we pass value 3, whereas in our main function X will become 4. For prefix form ( value(++X) ) we pass 4.
18th Dec 2017, 1:38 AM
Carrot Chan
Carrot Chan - avatar