
Originally Posted by
Frank S
I think that y++ means: the next object after y. But then I still don't understand the computation that follows. And I don't know at all what ++y means.
Thanks in advance.
These 2 demos might help:
Code:
var count = 0;
if(count++ < 5) {
// but at this point count now = 1
}
is the same as saying
Code:
var count = 0;
if(0 < 5) {
// but at this point count now = 1
}
but
Code:
var count = 0;
if(++count < 5) {
// but at this point count now = 1
}
is the same as saying
Code:
var count = 0;
if(1 < 5) {
// but at this point count now = 1
}
As soon as count++ or ++count are executed, the value of count is incremented by 1. ++ before count means count is first incremented and the new value is then used as the value of count in the statement and ++ after count means the current value of count is first used in the statement and count is then incremented by 1 after the statement is executed.
Bookmarks