iets3.opensource
iets3.opensource copied to clipboard
collection#upto doesn't include the maximum expression
Example: 1.upto(9).sum
equals 36 and not 45 because it sums up 1 up to 8. This is really counter-intuitive.
I propose a second argument inclusive
that is set to false by default to not make a breaking change.
For example: 1.upto(9,inclusive=false).sum
and 1.upto(9,inclusive=true).sum