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.
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?
surface
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?
next_float
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.
Thanks for the feedback. I’ll update the article accordingly ;-)
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.
In which case, for which value of
surface
the returning value will be different?Same applies to the case with floats, isn’t
next_float
superfluous?The cost of
next_float
and intermittent ranges doesn’t seem to justify that desire.Thanks for the feedback. I’ll update the article accordingly ;-)