Flash Sale: Flat 70% + Addl. 25% Off on all Courses | Use Coupon DS25 in Checkout | Offer Expires In

  Enroll Now

Scala - Function Representations

We have already discussed functions. We can write a function in different styles in Scala. The first style is the usual way of defining a function. Please note that the return type is specified as Int.

In the second style, please note that the return type is omitted, also there is no "return" keyword. The Scala compiler will infer the return type of the function in this case.

If the function body has just one statement, then the curly braces are optional. In the third style, please note that there are no curly braces.


No hints are availble for this assesment

Answer is not availble for this assesment

Loading comments...