Scala - Create a multiplier function Code Example

The code for Create a multiplier function

object MyClass {
  def main(args: Array[String]) {
    var b = 5
    
    val multiplier = (a: Int) => a * b
    
    println(multiplier(3))
  }
}

/*
Output:
15
*/
Code by IncludeHelp, on August 9, 2022 05:17

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.