iets3.opensource icon indicating copy to clipboard operation
iets3.opensource copied to clipboard

collection#upto doesn't include the maximum expression

Open alexanderpann opened this issue 6 months ago • 0 comments

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

alexanderpann avatar Aug 17 '24 20:08 alexanderpann