Michael de Kaste
04/11/2022, 9:31 AM[a..b]
we get with the ..
constructor (and even the until
keyword, which is still a [a..b]
range. They don't need to be progressions.Michael de Kaste
04/11/2022, 9:32 AMwhen(value){
in null until 4 -> "value1"
in 4 until 8 -> "value 2"
in 8 until null -> "value 3"
}
gildor
04/11/2022, 9:35 AMnull
means in this case that range is not limited on one side?
I understand it’s just to illustrate idea, but using null in this case is probably extremely confusing, imagine this code:
val from = if (Random.boolean) null : 1
from until 4
Michael de Kaste
04/11/2022, 9:38 AMgildor
04/11/2022, 9:38 AMMichael de Kaste
04/11/2022, 9:42 AMgildor
04/11/2022, 9:43 AM< 4
also works for this check, of cours you cannot use value implicitly, but at least it doesn’t require creation of new range
I mean if we concidering when
as use case for it. So if main goal is when, maybe we indeed should discuss possible when syntax changes, to support more use cases like in/equalsMichael de Kaste
04/11/2022, 9:52 AMwhen(value){
in 3.2 until 3.3 -> "value1"
in 3.3..3.5 -> "value1"
}
This ofcourse giving a syntax error nowkqr
04/11/2022, 12:32 PM<
>
? is opened range till MIN/MAX value?