Seriously,
I am really confused...
Help me out here. :/ please
Seriously,
I am really confused...
Help me out here. :/ please
/ means division. You should know what division is. 5/2 = 2.5.
However, % means modulus. Modulus is like division, but it returns the remainder (thank you Perci1 for pointing out my mistake). If you did 5 % 2, you would get 1. You could then do 5 - 1 = 4, 4/2 = 2, and that's how many times 2 goes into 5 entirely. Here are more examples:
11 % 5 = 1 12 % 6 = 0 14 % 6 = 2 20 % 15 = 5
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
That's not right -- modulus returns the REAMINDER, so 5%2=1. A quick print in studio shows this. Also take a look at the examples on the wiki: 11 % 3 = 2, 23 % 4 = 3. It gives you whatever's left over after dividing.
Hm. I tested it in Lua online and it returned 2. Maybe something went wrong? I'll check again: thanks for the heads up.