in reply to post-increment/pre-increment blues
print ++$i + 1; # prints 2, increment and than add 1 print $i++ + 1; # prints 2, $i==1, take the old $i (1) and ad +d 1, the increment happens after the sum was calculated print $i + $i++; # prints 5, $i==2, the increments happens fir +st and we get 2+3 print ++$i + ++$i; # prints 10, $i==3, the pre increment is done + twice because it's precedens on '+' and than we get 5+5 print ++$i + $i++ + 1; # prints 14, $i==5, didn't figure out yet
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: post-increment/pre-increment blues
by hotshot (Prior) on Jun 18, 2002 at 09:56 UTC | |
|
Re: Re: post-increment/pre-increment blues
by Juerd (Abbot) on Jun 18, 2002 at 14:59 UTC |