I'm reading a book on scala programming (the Programming in Scala), and I've got a question about the yield syntax.
According to the book, the syntax for yield can be expressed like: for clauses yield body
but when I try to run the script below, the compiler complains about too many arguments for getName
def scalaFiles =
for (
file <- filesHere
if file.isFile
if file.getName.endsWith(".scala")
) yield file.getName {
// isn't this supposed to be the body part?
}
so, my question is what is the "body" part of the yield syntax, how to use it?