Is there some way to create range withou having to...
# getting-started
p
Is there some way to create range withou having to sort it first? I mean,
10..0
creates empty range, and I have to change it to
10 downTo 0
. But I don't want to bother with it. I would expect
10..0
to do it automaticaly.
s
you could write your own extension infix function on
Int
to return a range that does the sorting for you.
s
making
10..0
step downwards automatically is potentially a pretty sneaky source of bugs. It was expressly decided that range ordering be explicit in order to avoid a footgun
2
☝️ 1