Scala - Function

2 - Syntax

def functionName ([list of parameters]) : [return type]

3 - Signature

4 - High Order

Higher order functions are functions that take a function as a parameter or return functions.

5 - Evaluation

  • Call by value: evaluates the function arguments before calling the function
  • Call by name: evaluates the function first, and then evaluates the arguments if needed
def square(x: Double)    // call by value
def square(x: => Double) // call by name
def myFct(bindings: Int*) = { ... } // bindings is a sequence of int, containing a varying # of arguments

Data Science
Data Analysis
Data Science
Linear Algebra Mathematics

Powered by ComboStrap