我想知道在块内部和外部使用相同名称的变量时变量的范围是什么。一个例子会自言自语:
NSSet *test = [NSSet setWithObjects@"Test"];
void (^onComplete)(id) = ^(NSSet *test) {
// do we see the variable define as an argument of the block or the variable define outside of the block?
NSSet *test2 = test;
}
NSSet *test3 = test;
这里有什么可能的冲突吗?