diff options
author | Artur Mkrtchyan <mkrtchyan.artur@gmail.com> | 2014-12-20 23:03:25 +0100 |
---|---|---|
committer | Artur Mkrtchyan <mkrtchyan.artur@gmail.com> | 2014-12-20 23:03:25 +0100 |
commit | 6027c90c90a55702d003f17a72fd82ed7f870be0 (patch) | |
tree | 177f86ac00d9cd9d96ba1858d4ff34ded452dd3d /scala.html.markdown | |
parent | fe856e7117c49aace8417f7fc1ccedaff6fcca8c (diff) |
Scala compiler fails to infer the return type when there's an explicit return statement
Diffstat (limited to 'scala.html.markdown')
-rw-r--r-- | scala.html.markdown | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scala.html.markdown b/scala.html.markdown index 5a478f2a..35645922 100644 --- a/scala.html.markdown +++ b/scala.html.markdown @@ -199,7 +199,7 @@ 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 foo(x: Int): Int = { val anonFunc: Int => Int = { z => if (z > 5) return z // This line makes z the return value of foo! |