+ 2
What is prefix and post-fix in c#? explained and detail huhu I don't understand
4 Antworten
+ 8
Hi, the difference basically is that in x++ (postfix) the variable is evaluated and then 1 is added, while in ++x (prefix) 1 is added, and then the variable is evaluated
As you can see in the code, the final result is the same in both cases, but the process is different
It should be clarified that the same thing happens with the decrement x-- and --x, only that a unit is subtracted instead of beign added
https://code.sololearn.com/czTTaQPf7VnO/?ref=app
+ 4
You're welcome!
Decrement works in a similar way, only that 1 unit is subtracted instead of being added
By postfix (x--) the variable is evaluated and then 1 is subtracted, while by suffix (--x) 1 is subtracted and then the variable is evaluated, check the code to see the example
https://code.sololearn.com/ci6In2BrQLr6/?ref=app
+ 2
Mariano Fregosi thankyouuuuu!! ❤
0
Thank youuuu so much, how about decrement what is it?