Call a function: Difference between revisions

m
minor edit to formatting of Scala section
(Filling out Scala section)
m (minor edit to formatting of Scala section)
Line 1,983:
 
def allParamsOptional(firstOpt: Int = 42, secondOpt: String = "foobar") = ???
allParamsOptional() // function with all optional args
//* allParamsOptional --*/ // error: missing arguments for method allParamsOptional;
// // follow with `_' if you want to treat it as a partially applied function
 
def sum[Int](values: Int*) = values.foldLeft(0)((a, b) => a + b)
Anonymous user