29.09.2013, 21:05
Err - no you didn't!
Or as most people would write it:
Note that you have to be MUCH more careful with OBOEs (Off By One Errors) with downwards loops - that code above will run 11 times, including for index 10, which will cause errors if any arrays re of size 10. An alternate way that avoids this issue is:
Those are all equivalent, and will run from 9 to 0 (inclusive).
pawn Код:
for (new i = 10; i != 0; --i)
pawn Код:
for (new i = 10; i >= 0; i--)
pawn Код:
for (new i = 10; --i != 0; )
pawn Код:
for (new i = 10; --i >= 0; )
pawn Код:
for (new i = 10; i-- > 0; )