diff options
author | Geoff Liu <cangming.liu@gmail.com> | 2015-04-17 11:52:55 -0400 |
---|---|---|
committer | Geoff Liu <cangming.liu@gmail.com> | 2015-04-17 11:52:55 -0400 |
commit | 5a631baf3e6e03c9ac6f7780eedd46a66e92d127 (patch) | |
tree | 6065ad7e496e7967a278a1f57930fbedb3269bdb /scala.html.markdown | |
parent | 6e9ccfaea3bf2963dc624cd7a6cc198cd1147aa9 (diff) | |
parent | c8c6924dccf3184b0c2c60226291de3cae4c1380 (diff) |
Merge pull request #1039 from Alwayswithme/scala/zh
[scala/cn]translate scala doc into chinese
Diffstat (limited to 'scala.html.markdown')
-rw-r--r-- | scala.html.markdown | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scala.html.markdown b/scala.html.markdown index ed1ddabb..e6638121 100644 --- a/scala.html.markdown +++ b/scala.html.markdown @@ -186,7 +186,7 @@ val sq: Int => Int = x => x * x // Anonymous functions can be called as usual: sq(10) // => 100 -// If your anonymous function has one or two arguments, and each argument is +// If each argument in your anonymous function is // used only once, Scala gives you an even shorter way to define them. These // anonymous functions turn out to be extremely common, as will be obvious in // the data structure section. @@ -465,6 +465,7 @@ val patternFunc: Person => String = { // Scala allows methods and functions to return, or take as parameters, other // functions or methods. +val add10: Int => Int = _ + 10 // A function taking an Int and returning an Int List(1, 2, 3) map add10 // List(11, 12, 13) - add10 is applied to each element // Anonymous functions can be used instead of named functions: |