Re:Swift is like Kotlin
by throwaway91111 on Thursday May 18, 2017 @12:24AM
(#14364802)
Why is it a..b instead of the logical a..=b or a..<=b?
You only need to know that the language handles one explicitly, since there's two choices, so you might as well take the (more common | uglier to express) case and give it the "cleanest" special syntax: no special syntax.
"a..b - 1" can also be written as "a until b" in Kotlin.
as for the "count - 1", it's not too bad because i find "inclusive" more intuitive than "exclusive" for the a..b notation, and that does make it explicit that you're not including b, but it's visual clutter in much the same way that having to iterate an array via "for i = 0 to len - 1" is.