Is it possible to match a range of values in Scala?
For example:
val t = 5
val m = t match {
0 until 10 => true
_ => false
}
m
would be true
if t
was between 0 and 10, but false otherwise. This little bit doesn't work of course, but is there any way to achieve something like it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…