J
Jon Skeet [C# MVP]
Vincent Lascaux said:If you dont write such things, then i++ and ++i has the exact same meaning,
and ++i is what you mean.
If they have exactly the same meaning, then i++ must be what I mean as
well, surely.
But I agree with you (even if it is laughably
ridiculous) that i++ is more easy to read than ++i because we are used to
put the operator after the variable (like in i+1). But it's not really hard
to read ++i, and I bet your brain will learn that really quickly... I still
think that it's sad that people are tought to write i++, and actually write
i++ when the meaning of ++i is much more simple.
I don't think it's actually that much simpler, to be honest.
i++:
The value of the expression is the initial value of i, and i is
incremented.
++i;
i is incremented, and the value of the expression is the new value of
i.
As I've said, when you rely on the difference, you're likely to make
code less readable than if you separate the statements out anyway.