1. 2
  1.  

  2. 3

    On a related note it’s been nice seeing pattern matching making its way into languages recently. It’s not revolutionary but is handy for the exclusion of doubt when debugging.

    1. 3

      Here we can see that we exclude the left value by omitting it in the range — starting by 91 instead of 90 in order to exclude the 90 value.

      In which case, for which value of surface the returning value will be different?

        when 70..90   then :second_value
      - when (91..inf) then :third_value
      + when (90..inf) then :third_value
      

      Same applies to the case with floats, isn’t next_float superfluous?

      But, what if I want to exclude the left operand?

      The cost of next_float and intermittent ranges doesn’t seem to justify that desire.

      1. 1

        Thanks for the feedback. I’ll update the article accordingly ;-)