SA-MP Forums Archive
What is the meaning of this code - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What is the meaning of this code (/showthread.php?tid=539914)



What is the meaning of this code - Raefal - 01.10.2014

for (new i = length, l = 0; --i >= 0; l ++)
{
if ((l > 0) && (l % 3 == 0)) strins(value, ",", i + 1);
}

i Dont know about this code:

l % 3 == 0

What does the code mean?


Re: What is the meaning of this code - renegade334 - 01.10.2014

% is the modulo operator. a % b basically gives you the remainder when you divide a by b.

http://en.wikipedia.org/wiki/Modulo_operation