in reply to Closures Explained

“Padewan, when you need to use Closures, you will know.”

In a word, “a closure has a memory.” That is, it has access to a set of variables and values, that are known only to itself but that are persistent (and unique) for as long as the closure itself exists.

So, for example, I could hand you a closure that, each time you call upon it, returns a number one-greater than the number it returned the last time you called upon it. And yet, I could hand you just as many copies of that closure as I desired, and each one would exhibit that behavior.

“Cool, huh?”

Replies are listed 'Best First'.
Re^2: Closures Explained
by Jenda (Abbot) on Jul 14, 2009 at 15:21 UTC

    I don't think the quote is true. If you do not know something exists (or know just the name, but do not know what the heck it actually is), you cannot know whether you need it. And you'll instead spend time finding some way to get around that.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.