In this case, we passed in the following function literal.
在这个例子里,我们传入这样的一个字面函数。
We use a _ placeholder shortcut again in another function literal that we pass to foreach.
我们在传给foreach 的这个字面函数中再一次使用了一个 _占位符。
This expression is actually the body of an "anonymous function", called a function literal in Scala.
这个表达式实际上是一个“匿名函数”的函数体,在Scala中称为字面函数。
This function literal does a pattern match on the message instance to decide how to handle the message.
这个字面函数给消息做了一个模式匹配来决定它被如何处理。
The method body calls the map method on the strings array, which takes a function literal as an argument.
函数的主体调用了strings数组的map方法,它接受一个字面函数(Function Literal)作为参数。
If a function literal is anonymous, there should be one space between the word function and the left parenthesis.
如果函数是匿名函数,则在function和左括号之间应有一个空格。
Note that an assignment statement which is assigning a function literal or object literal is still an assignment statement and must end with a semicolon.
注意一个函数赋值或对象赋值语句也是赋值语句,应该以分号结尾。
Note that an assignment statement which is assigning a function literal or object literal is still an assignment statement and must end with a semicolon.
注意一个函数赋值或对象赋值语句也是赋值语句,应该以分号结尾。
应用推荐