diff --git a/exercises/concept/wellingtons-weather-station/.docs/introduction.md b/exercises/concept/wellingtons-weather-station/.docs/introduction.md index 8883926d..87a5027c 100644 --- a/exercises/concept/wellingtons-weather-station/.docs/introduction.md +++ b/exercises/concept/wellingtons-weather-station/.docs/introduction.md @@ -101,6 +101,9 @@ The `%` operator is used for modulus. 5 % 3 # => 2 + +-7 % 5 +# => 3 ``` ~~~~exercism/caution @@ -111,6 +114,13 @@ This is different from normal division. 1 % 0 # Error: Unhandled exception: Division by 0 (DivisionByZeroError) ``` + +Note that unlike some other programming languages crystal is using floored division to calculate modulus (in JavaScript this would yield -1) + +```crystal +-6 % 5 +# => 4 +``` ~~~~ ## Rounding