Ad
  • Custom User Avatar

    Hello, I get the exact same result in Ruby. Would it be possible to see the inputs?

  • Custom User Avatar

    % 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 ...

  • Custom User Avatar

    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 )

  • Custom User Avatar

    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 :)