Scala Float until(end: Float, step: Float) method with example
The until(end: Float, step: Float) method is utilized to return a range from the start value to exact previous value of specified end float value. Here the range’s values are jumping by step value.
Method Definition: defuntil(end: Float, step: Float): collection.immutable.Range
Return Type: It returns the range.
Example #1:
// Scala program of Float until() // method // Creating object object GfG { // Main method def main(args : Array[String]) { // Applying until method val result = ( 1.0 ).until( 12.0 , 3.0 ) // Displays output println(result) } } |
chevron_right
filter_none
Output:
NumericRange(1.0, 4.0, 7.0, 10.0)
Example #2:
// Scala program of Float until() // method // Creating object object GfG { // Main method def main(args : Array[String]) { // Applying until method val result = ( 3.0 ).until( 20.0 , 2.0 ) // Displays output println(result) } } |
chevron_right
filter_none
Output:
NumericRange(3.0, 5.0, 7.0, 9.0, 11.0, 13.0, 15.0, 17.0, 19.0)