The NSLog
doesn't make a difference here. It's the ;
that is making the difference:
switch(var1) {
case 1:
;
float x = 0;
view.setCenter(CGPointMake(x,100));
break;
compiles. Even
switch(var1) {
case 1:;
float x = 0;
view.setCenter(CGPointMake(x,100));
break;
What cannot compile is float
(or other type) immediately after :
. In other words, a command is expected after :
, not a declaration.