+ 2

Why do we need post increments and decrements? how are they useful?

21st Apr 2016, 10:18 AM
Angela Lin
Angela Lin - avatar
3 Answers
+ 3
Post increments/decrements are useful when you need to use the value of the variable and then increment/decrement it. There are a lot of use-cases, which are mainly connected with the logic of your code.
26th May 2016, 1:30 PM
James Flanders
+ 2
they are shortcut of writing. we can write a=d; d=d+1; or just a=d++
6th Nov 2016, 2:36 AM
Sandeep Chatterjee
- 1
{y=i++;}=={y=i;i=i+1;} and {y=++i;}=={i=i+1;y=i;}. I think that is convenient when using It in expression in loop. try the code below: {int i=0; i=i++;Console.writeline(i);}
14th Jun 2016, 6:11 PM
Jim
Jim - avatar