1
我想知道在塊內外使用同一變量名時變量的作用域是什麼。一個例子將從自身談起:塊內外的變量範圍
NSSet *test = [NSSet [email protected]"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;
這裏是否有任何可能的混淆?