February 2018
Intermediate to advanced
552 pages
13h 46m
English
In Scala, functions are first-class citizens because we can do the following things with them:
We will discuss the last two points in the Scala Higher-Order Functions section. Let's discuss the first two points here.
We can use a function like a normal value or variable, as shown here:
scala> def doubleIt(x: Int) = x * x doubleIt: (x: Int)Int scala> def addOne(x: Int) = x + 1 addOne: (x: Int)Int scala> val result = 10 + doubleIt(20) + addOne(49) ...
Read now
Unlock full access