are there kotlin functions that constrain number p...
# announcements
h
are there kotlin functions that constrain number parameters to a range?
k
Something like
number.coerceIn(min..max)
?
👍 1
h
yes exactly like that
👍 1
it would be nice to have a syntax like
var x: Int in a..b
as well if you could use
..
like
..a
and
b..
to imply to infinity (or rather the max/min values of the data type)
or if i got everything i wished, then Ranges could use interval notation
var x: Int in (a, b]
var y in ['a', 'z']
but of course that would interfere with the understanding of lists