How to define vector in Scala

1 Answer

0 votes
object O {
    def main(args: Array[String]): Unit = {
        val vec = Vector(5, 9, 2, 8, 1)  
 
        print(vec)
        
        println()
         
        vec.foreach(println(_))
    }
}
   
    
    
    
/*
run:
    
Vector(5, 9, 2, 8, 1)
5
9
2
8
1
    
*/

 



answered Sep 7, 2020 by avibootz
...