Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4
Please read this article, it will help you get the point: http://www.skorks.com/2010/05/closures-a-simple-explanation-using-ruby/ Even if examples are in Ruby you should have a look at those sub-headings for overview: "A Concept Explained Simply" "Why Are Closures Useful" Explanation borrowed from it: "A closure is basically a function/method that has the following two properties: You can pass it around like an object (to be called later) It remembers the values of all the variables that were in scope when the function was created. It is then able to access those variables when it is called even though they may no longer be in scope." This article was written in 2010 so take into account that now Java and C++ implement closures.
29th Nov 2016, 8:00 AM
Jean-Hugues de Raigniac
Jean-Hugues de Raigniac - avatar