Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What does the percentage symbol % do in the script ?

Asked by 4 years ago

I've tried finding answers but couldn't find it, can someone tell me what the "%" does so that I can have a better understanding of what others have coded.

1 answer

Log in to vote
0
Answered by
zadobyte 692 Moderation Voter
4 years ago

% is a mathematical operator named modulo. It returns the remainder of the division between two numbers. For example:

print(2%2) --prints 0 because 2 goes into 2, 1 time evenly.
print(5%2) --prints 1 because 2 goes into 5, 2 times, leaving 1 behind
0
Thanks, I have no idea how I've forgotten such a vital thing ??????? AK47GOLDgun 9 — 4y
0
no problem, it happens zadobyte 692 — 4y
Ad

Answer this question