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.

#functions #scala
default parameter values in function header:
def addInt( a:Int=5, b:Int=7 ) : Int
If you want to change selection, open document below and click on "Move attachment"

Scala Default Parameter Values for a Function
e the corresponding argument will be filled in with the default. Following is an example of specifiying default parameters: object Test { def main(args: Array[String]) { println( "Returned Value : " + addInt() ); } <span>def addInt( a:Int=5, b:Int=7 ) : Int = { var sum:Int = 0 sum = a + b return sum } } When the above code is compiled and executed, it produces the following result: C:/>scalac Test.scala C:/>scal


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



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