Possible Duplicate:
Storing Blocks in an Array
I am writing an application where at times based on certain conditions I want to run certain piece of code after certain event has occurred. this code could be at multiple places accessing variables in the functions that wont be in scope when this code needs to be executed. Is it possible to store these statements as blocks inside an array and exceute them one by one when the event occurs. If yes, how do I access variables of the previous scope?
I wanted to make this as an array of closures.