Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSMutableArray *todos = [NSMutableArray array];
void (^addTask)(NSString *) = ^(NSString *task){ [todos addObject:task]; NSLog(@"%@", todos); };
void (^removeTask)(NSInteger) = ^(NSInteger index){ [todos removeObjectAtIndex:index]; NSLog(@"%@", todos); };
// Simulate actions
addTask(@"Buy milk");
addTask(@"Write Objective-C code");
removeTask(0);
}
return 0;
}Coding works best on desktop or with an external keyboard.