While a block is just a piece of code that can be composed by statements and declarations but nothing else, a closure is a real first-class object, a real variable that has a block as its value.
The main difference is that a block simply groups instructions together (for example the body of a while statement), while a closure is a variable that contains some code that can be executed.
If you have a closure usually you can pass it as a parameter to functions, currify and decurrify it, and mainly call it!
Closure c = { println 'Hello!' }
/* now you have an object that contains code */
c.call()
Of course closures are more powerful, they are variables and can be used to define custom behaviour of objects (while usually you had to use interfaces or other OOP approaches in programming).
You can think of a closure as a function that contains what that function does inside itself.
Blocks are useful because they allow scoping of variables. Usually when you define a variable inside a scope you can override the outer definitions without any problems and new definitions will exist just during the execution of block.
for (int i = 0; i < 10; ++i)
{
int t = i*2;
printf("%d\r\n", t);
}
t
is defined inside the block (the body of the for
statement) and will last just inside that block.