Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of using blocks

Tags:

People also ask

What is the purpose of block in Objective-C?

Blocks are a language-level feature added to C, Objective-C and C++, which allow you to create distinct segments of code that can be passed around to methods or functions as if they were values. Blocks are Objective-C objects, which means they can be added to collections like NSArray or NSDictionary .


I want to use blocks in my application, but I don't really know anything about blocks. Can anyone explain how and why I should use blocks in my code?