| Define Closure in Scala with example?
Closure is one of the function define in Scala whose return value depends on the value of the variable declared outside the closure function. Below is the example of closure function:-
Example 1:-
Output:-
res45:Int = 25
Example 2:-
Output
res46:Int = 35
In example 2 mul2 takes the new value of 'c' when it is second time. | | |