Scala Int until(end: Int) method with example
Last Updated :
30 Jan, 2020
The until(end: Int) method is utilized to return a range from the start value to exact previous value of specified end integer value.
Method Definition: defuntil(end: Int): collection.immutable.Range
Return Type: It returns the range.
Example #1:
object GfG
{
def main(args : Array[String])
{
val result = ( 1 ).until( 9 )
println(result)
}
}
|
Output:
Range(1, 2, 3, 4, 5, 6, 7, 8)
Example #2:
object GfG
{
def main(args : Array[String])
{
val result = ( 10 ).until( 17 )
println(result)
}
}
|
Output:
Range(10, 11, 12, 13, 14, 15, 16)
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...