Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
% means Modulo operation.
https://en.wikipedia.org/wiki/Modulo_operation
if (x % 3 === 0) means x could be one of the values 0, 3, 6, 9, ..., x, 3x, ..., it could be -3, -6, -9 and ...
Sure,
"/" is indeed used to divide.
So: 4 / 2 is equal to 2
And:6 / 3 is also equal to 2
However when you use the % operation the result is equal to the remainder left after a division
So: 4 % 2 is equal to 0 because there is no remainder when you divide 4 by 2
However: 7 % 3 is equal to 1 because 1 is the remainder (3 X 2 )
Could someone please explain what is happening here? Isn't / used for divide and not %? What does % mean? I think I misunderstood the kata in that case, since I was trying to multiply and wasn't passing the right arguments. But when I tried it the other way around (dividing) nothing worked for the kata, so now I checked solution and people are using %. Guess I have to look that up... Not having English as my native language sure didn't help :)
Yes, it definately should. I had a real annoying time trying to finish the kata since it said nothing about case sensitivity in the description... spent a long time wondering if my regex was off or not.