KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Why does Scala fail to infer the return type of the method when there's an explicit return statement used in the method? For instance, why does the following code compile? object Main { def who = 5 def main(args: Array[String]) = println(who) } But the following doesn't. object Main { def who = return 5 def main(args: Array[String]) = println(who) }
Tags (comma-separated)
Save Edits
Cancel