First of all (sorry for missing that), I stumbled on this text while translating, not gaming.
I’m kind of going ahead for a student who is not fluent at English language.
(And I would not spoil the experience for him by gaming ahead). Moreover, it seems that you would need to be subscribed for playing that level.
But back to the question:
I’m adding the full text from the Overview-section here to make it clearer:
The modulo
operation returns the remainder after division of one number by another.
The modulo
function must return a value from 0 to X
, where X
is modulo operand.
For the current level, it’s enough to use the shortened version of it.
While input argument (n
) is less than the X
it returns the input number.
But when n
is greater or equal to the X
it must reduce the input number by X
.
The second function mod40
must return a value from 0 to 40.
_In the sample code, it works only until n < 40
. _
But when n >= 40
it returns a wrong value.
_To complete the function you need to check an input value _
if it’s greater or equal than 40 – if (n >= 40)
.
If it’s true, then substract 40 – n = n - 40
.
From:
While input argument (n
) is less than the X
it returns the input number.
But when n
is greater or equal to the X
it must reduce the input number by X
.
I would deduce that that the value X never can be returned, as X will be subtracted when the value n is equal or greater X. So if n was X, X would be subtracted an 0 returned.
This is how the modulo function should be working i. e.
the Range of n modulo X would be between 0 and X-1.
So, if I’m not beeing confused compeletely, the above text should be changed from
The modulo function must return a value from 0 to X, where X is modulo operand.
to
The modulo function must return a value from 0 to X-1, where X is modulo operand.
and from
The second function mod40 must return a value from 0 to 40.
to
The second function mod40 must return a value from 0 to 39
I hope my point is somewhat clearer now…
NB: I notice I should rather play the levels first instead of checking the translation in hindsight, but I’d rather not to Kithgard myself…