Home »
Code Examples »
Scala Code Examples
Scala - Methods with multiple input parameters Code Example
The code for Methods with multiple input parameters
// Here's a method that takes two input parameters
def sum(x: Int, y: Int) = x + y
// Here’s the same method, with the method's
// return type explicitly shown:
def sum(x: Int, y: Int): Int = x + y
// Here's a method that takes three
// input parameters:
def sum(x: Int, y: Int, c: Int): Int = x + y + c
Code by IncludeHelp,
on August 8, 2022 02:22