How to generate an containing a sequence of increasing integers in Scala

2 Answers

0 votes
import Array._

object O {
    def main(args: Array[String]): Unit = {
        var arr = range(13, 23, 3)

        for (n <- arr) {
             println(n)
        }
    }
}
 
 
 
 
/*
run:
 
13
16
19
22

*/

 



answered Sep 6, 2020 by avibootz
0 votes
import Array._

object O {
    def main(args: Array[String]): Unit = {
        var arr = range(7, 13)

        for (n <- arr) {
             println(n)
        }
    }
}
 
 
 
 
/*
run:
 
7
8
9
10
11
12

*/

 



answered Sep 6, 2020 by avibootz
...