我看到了这个问题的一些答案,我明白了 - 你不能在一个内部声明和分配变量switch.但我想知道以下是否正确抛出错误说
错误:'int'之前的预期表达式
码:
switch (i) {
case 0:
int j = 1;
break;
}
Run Code Online (Sandbox Code Playgroud)
为什么NSLog()在它之前拨打电话会导致没有错误?
switch (i) {
case 0:
NSLog(@"wtf");
int j = 1;
break;
}
Run Code Online (Sandbox Code Playgroud)