2 ms·
>> If I say `for x in range(10)` it iterates exactly 10 times Right and I expect that. The issue I have is that the values do not include 10. It turns out grea
by phkahler 8y ago
>> If I say `for x in range(10)` it iterates exactly 10 times
Right and I expect that. The issue I have is that the values do not include 10. It turns out great in Python and Rust where things are 0-indexed, but that does not change the fact that the range construct itself is strange in not including 10.
I'm sure the notion of using mathematical notation where [1..10], (0..10], [1..11), and (0..11) all mean the same thing would drive the language parsing people nuts. Mostly because some of those involve unmatched [) or (]. But that's why we have a computer right?