diff options
author | Adam Bard <github@adambard.com> | 2015-01-03 20:12:35 +0000 |
---|---|---|
committer | Adam Bard <github@adambard.com> | 2015-01-03 20:12:35 +0000 |
commit | c4036c6514a7a774fbff4ce51a41ed2a55df624e (patch) | |
tree | 113d815106dd8f9e8e2ab24ae18b0e7abf7f8506 /scala.html.markdown | |
parent | 732cdbed1ad345f2b826254bc7f0b6283124955e (diff) | |
parent | d7672a2bc53dd8b81c4da8c620178cc2458c9238 (diff) |
Merge pull request #890 from arturmkrtchyan/master
[scala] Fixed function return type
Diffstat (limited to 'scala.html.markdown')
-rw-r--r-- | scala.html.markdown | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scala.html.markdown b/scala.html.markdown index 544abd5b..336251ba 100644 --- a/scala.html.markdown +++ b/scala.html.markdown @@ -198,8 +198,10 @@ weirdSum(2, 4) // => 16 // The return keyword exists in Scala, but it only returns from the inner-most -// def that surrounds it. It has no effect on anonymous functions. For example: -def foo(x: Int) = { +// def that surrounds it. +// WARNING: Using return in Scala is error-prone and should be avoided. +// It has no effect on anonymous functions. For example: +def foo(x: Int): Int = { val anonFunc: Int => Int = { z => if (z > 5) return z // This line makes z the return value of foo! |