Closures

Closures paradigm is amazing. It is supported mainly from functional languages.

Let’s make an example.

function first(x) {

function second(y) {

return x + y

}

return second(y)

}

So calling first(10) we will get return function(y) { return 10 + y}

in example:

add_10 = first(10)

add_10(2) returns 12