What is the % for in this script? It's the "if i % 2 == 0 then" part that confuses me.
for i = 1, 20 do if i % 2 == 0 then print(i .. " even") else print(i .. " odd") end end
It is the modulus operator.
It gets the remainder if you divide the first number by the second.
Examples:
print(5 % 2) --> 1 (Because 5 / 2 = 2, remainder 1) print(10 % 4) --> 2 (10 / 4 = 2, remainder 2)