You can usually use map
instead of foreach
:
List("a","b","c") foreach println
can be replaced with
List("a","b","c") map println
except for the return type, which you aren't interested in anyway when using foreach
.
You can usually use map
instead of foreach
:
List("a","b","c") foreach println
can be replaced with
List("a","b","c") map println
except for the return type, which you aren't interested in anyway when using foreach
.