Categories
Resources Software Development

Scala Closure Functions resources, links and info

What is a Closure function in Scala? The simple answer is, it is a dirty function that uses variables declared outside the function inside the function, which are not passed as values to the function.

I call them dirty functions because it feels dirty to have some unknown variable outside of a function have power to influence the outcome of the operation in a function. This can be a class or object where the variable is defined or to have even more fun in Scala it can also be an implicit variable from an import.

So again a closure is a dirty function that takes values as parameters but also accesses variable values from outside of the function that are not passed to the function directly… dirty
Scala Tutorial 15 – How to use closures in Scala

This video demonstrates Scala Closures in detail.