#odersky-programming-in-scala-2ed #p194 #scala

If you are writing a partially applied function expression in which you leave off all parameters, such as println _ or sum _, you can express it more concisely by leaving off the underscore if a function is required at that point in the code, e.g. instead of
someNumbers.foreach(println _)
you could just write
someNumbers.foreach(println)


Discussion

Do you want to join discussion? Click here to log in or create user.