Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading