Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
rudasn
on Jan 21, 2011
|
parent
|
context
|
favorite
| on:
Hiring Front-End Engineers
I really regret not paying attention to maths at school. What exactly is the % doing there? What is the purpose of % normally?
nostrademons
on Jan 21, 2011
[–]
% is the modulus operator. It's the remainder when you divide...so 0 % 4 == 0, 1 % 4 == 1, 2 % 4 == 2, 3 % 4 == 3, then 4 % 4 == 0 again. It's useful in that the result cycles through 0 <= x % n < n.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: