What's up with a++ ++b | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What's up with a++ ++b

What do the ++ stand for and what do they do to the number?

12th Dec 2016, 11:04 PM
Tomas Brainskas
Tomas Brainskas - avatar
2 Answers
+ 2
a++ its a post increment, so it will use the acutal value of a, and then increment the value by 1. ++a increments before the operation. so var a = 1; print(a++); //this will show 1.now a value its 2. var b =1; print (++b); //this will show 2, and the value of b its 2.
12th Dec 2016, 11:12 PM
Nahuel
Nahuel - avatar
+ 1
a++ is a post increment operator while ++b is a pre increment operator.....
13th Dec 2016, 12:11 PM
Shreet Rathore
Shreet Rathore - avatar