Can somebody explain me about Increment and decrement operator? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can somebody explain me about Increment and decrement operator?

In the course the comment section says its wrong .

1st Jul 2016, 7:31 AM
Nishant Gautam
Nishant Gautam - avatar
3 Answers
0
var x, y, a, b; x = 1; y = 2; a = x++; // a = 1, x = 2, first we use x, then increment it b = --y; // b = 1, y = 1, first decrement y, then use it
1st Jul 2016, 3:28 PM
buremu
0
The increment in above example is post increment in which first value of X is assigned to a and after that the value of X is Incremented by 1. The decrement is pre decrement which means fir at the decrement is done in rhe value of y and the decreased value is assigned to b
1st Jul 2016, 4:48 PM
Gaurav Sharma
Gaurav Sharma - avatar
0
Thanks mates, Highly appreciated for your answers 🙌🙏🙏
1st Jul 2016, 4:54 PM
Nishant Gautam
Nishant Gautam - avatar