27.12.2018, 14:27
Goes To
Just a brief tutorial to tell people about the “goes to” operator: -->. The arrow design is to show it goes towards the number, thus it decrements a variable until it reaches zero, and can be used in loops to loop a number of times. Mainly the while loop:Code:
new i = 10; while (i --> 0) { printf("%d", i); }
9
8
7
6
5
4
3
2
1
0
Note that 10 is not included, while 0 is. This makes it like normal loops, but backwards.
You can loop over players backwards with:
Code:
for (new i = MAX_PLAYERS; i --> 0; ) { }
Code:
new j = 10; while (j --> 5) {}
Code:
new j = 10; while (j-- > 5) {}