in Technology by (1.8m points)

What are blocks and how are they used?

1 Answer

0 votes
by (1.8m points)

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.

The syntax to define a block literal uses the caret symbol (^), like this:


NSLog(@”This is a block”);