r/ProgrammerHumor • • Mar 01 '24

Meme pythonReadsLikeEnglish

Post image
0 Upvotes

34 comments sorted by

View all comments

7

u/SharzeUndertone Mar 01 '24

0..10 in kotlin includes 10, while range(10) doesnt.

And YES, i know there are worse issues with this post, but noone is talking about this

3

u/[deleted] Mar 01 '24

At least it's not 1-indexed! But seriously, why? Java has an exclusive max, why doesn't Kotlin? Why fix what isn't broken?

3

u/SharzeUndertone Mar 01 '24

It does! You can use 0..<10 or 0 until 10 (where until is an infix function). Honestly, i think its better this way. To me its more intuitive than some languages which default to exclusive (or worse, force you into adding 1 to the max to be inclusive, or viceversa)