分支语句if
#import <Foundation/Foundation.h>
int mainj (int argc,const char * argv[] ){
@autoreleasepool {
int a = 1;
NSLog(@"a的值为%d",a);
int b = 2;
NSLog("b的值为%d",b);
if(a>b){
NSLog(@"这句话是真的!");
}
NSLog(@"hehe");
}
return 0;
}
高级跳转语句goto
#import<Foundation/Foundation.h>
int main( int argc,const char * argv[]){
@autoreasepool{
int i = 0;
a:{
i++;
NSLog(@"i的值为%d",i);
}
if(i<5) {
goto a;
}else{
goto b;
}
b:{
NSLog(@"跳远了!");
}
return 0;
}
时间: 2024-10-13 01:51:01