+ 2
Does post/pre increment/decrement work the same in all languages and do they even exist in all languages?
x = 5 y = 7 z = x++ + --y I understand that x is updated after evaluating z and y is updated during evaluation in C++, is it the same in all languages? Does x and y retain the updated value just like in C++, especially with pre increment/decrement which I had trouble understanding!
3 Réponses
+ 3
Some results depend on the language.
{x= ++x + ++x + ++x ;}is the same in cpp and cs
however
{x += ++x;} gives a different result
+ 2
Take a look at my answer here, it might be related to your question: https://www.sololearn.com/Discuss/157809/pre-and-post-increment
+ 1
no post/prefer increment/decrement in Python, just do +=1