Home > other >  Is there a function which returns to upper bound of a Scala range?
Is there a function which returns to upper bound of a Scala range?

Time:11-07

Create a simple range in Scala: val range = (1 to 10) Now I wanna find a function that returns the upper bound of this range like: val upper = range.max (upper: Int = 10) Or something to that effect, is there a neat way to do this?

CodePudding user response:

You can browse the Scaladoc to find available methods. From what I understand end is what you're looking for:

range.end

https://www.scala-lang.org/api/current/scala/collection/immutable/Range.html#end:Int

  • Related