Download Getting Started with Scala 26-Jul-16

yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

More method definitions
def half(n: Int): Double = n / 2
You can state the result type explicitly
In this example, half(7) will return 3.5 (!)
def half(n: Int): Int = return n / 2
If you use a return statement, you must state the result type explicitly
Good style in Scala is to avoid using return statements, and just put the return
value as the last thing in the method