Scala – Closures
In this guide, we will discuss Scala Closures. A closure is a function, whose return value depends on the value of one or more variables declared outside this function. The following piece…
In this guide, we will discuss Scala Closures. A closure is a function, whose return value depends on the value of one or more variables declared outside this function. The following piece…
In this guide, we will discuss Scala Currying Functions. Currying transforms a function that takes multiple parameters into a chain of functions, each taking a single parameter. Curried functions are…
In this guide, we will discuss Scala Anonymous Functions. Scala provides a relatively lightweight syntax for defining anonymous functions. Anonymous functions in source code are called function literals and at run time,…
In this guide, we will discuss Scala Higher-Order Functions. Scala allows the definition of higher-order functions. These are functions that take other functions as parameters, or whose result is a function.…
In this guide, we will discuss Scala Recursion Functions. Recursion plays a big role in pure functional programming and Scala supports recursion functions very well. Recursion means a function can…
In this guide, we will discuss Scala Functions with Named Arguments. In a normal function call, the arguments in the call are matched one by one in the order of…
In this guide, we will discuss Scala Partially Applied Functions. When you invoke a function, you're said to be applying the function to the arguments. If you pass all the…
In this guide, we will discuss Scala Nested Functions. Scala allows you to define functions inside a function and functions defined inside other functions are called local functions. Here is an…
In this guide, we will discuss Scala Default Parameter Values for a Function. Scala lets you specify default values for function parameters. The argument for such a parameter can optionally…
In this guide, we will discuss Scala Function with Variable Arguments. Scala allows you to indicate that the last parameter to a function may be repeated. This allows clients to…