I have this code snippet:
val ln = List (1, 2, 3)
for (i <- ln){
println(i*2)
}
Is it possible to write the same code but using the List.foreach
method?
I have this code snippet:
val ln = List (1, 2, 3)
for (i <- ln){
println(i*2)
}
Is it possible to write the same code but using the List.foreach
method?