How to print set in Scala

1 Answer

0 votes
object O {
    def main(args: Array[String]): Unit = {
        val st = Set(1, 2, 3, 4, 5, 6)  

        for (element <- st) 
            println(element) 
    }
}
  
  
  
  
/*
run:
  
5
1
6
2
3
4
 
*/

 



answered Oct 14, 2020 by avibootz

Related questions

...