For example to print everything I can do
list.foreach(println(_))
How would I do the equivalent of
list.foreach(println(_ + "mystring"))
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In order to fix your second example you can name function argument like this:
By the way, as alternative you can at first
mapyour list and then print each element in it:This will produce the same results.