what is significant that prevents kotlin from allo...
# announcements
h
what is significant that prevents kotlin from allowing
..
operator to create descending ranges like
9..5
? Shouldn't it be somewhat trivial to put into the code to create one or the other based on the higher value? is it simply ambiguity?
g
This is intentional decision. To avoid subtle bugs with ranges.
👍 2
h
makes sense. if they were only used to make ranges with number literals, then it would probably be added functionality, but with variables, it becomes obscure
g
yes, because of variables and functions, such as indexOf, which may return
-1
so: 0..indexOf(smth) you getting range:
0..-1
👍 1
h
thanks for the explanation
g
and now it safe, you just get 0 length range