Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



#scala
The return keyword is not "optional" or "inferred"; it changes the meaning of your program, and you should never use it.
If you want to change selection, open document below and click on "Move attachment"

tpolecat
May 09, 2014 Don't Use Return in Scala Alright, every time Martin's Coursera course runs we get people in #scala asking why they get style points taken off for using return. So here's the pro tip: <span>The return keyword is not "optional" or "inferred"; it changes the meaning of your program, and you should never use it. Let's look at a little example. // Add two ints, and use this method to sum a list def add(n:Int, m:Int): Int = n + m def sum(ns: Int*): Int = ns.foldLeft(0)(add) scala> sum(33, 42,


Summary

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Details



Discussion

Do you want to join discussion? Click here to log in or create user.