Is general concept of closures in Swift similar to closures in Javascript, or do they use same word "closure" but with different rules? Specifically, (to quote my friend) closure in Javascript is "crystal ball that can peer only where it was created".
So, in Javascript this code works:
var outside = 5;
function test() {
alert(outside); // returns 5
}
Does that mean in Swift, if I create closure in any of the possible ways, it will have access to all local variables at same scope right where closure was created?
(I've looked at wikipedia definition of closure in programming, but it felt too vague - specifically, what values is closure keeping track of)