Scala Float until() method with example
The until() method is utilized to return a range starting from first point to end point. Here the first point is inclusive but the endpoint is exclusive.
Method Definition: (First_Point).until(End_Point)
Return Type: It returns the created 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 = (- 6 ).until( 0 )
println(result)
}
}
|
Output:
Range(-6, -5, -4, -3, -2, -1)
Last Updated :
29 Oct, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...