int main(int argc, const char * argv[]) { //for,foreach,while,do-while,switch NSMutableArray* mutableArray = [NSMutableArray arrayWithCapacity:2]; [mutableArray addObject:@"item1"]; [mutableArray addObject:@"item2"]; [mutableArray addObject:@"item3"]; NSLog(@"-------------------for---------------------"); for(NSUInteger i=0;i<[mutableArray count];i++) { NSLog(@"%@",[mutableArray objectAtIndex:i]); } NSLog(@"-------------------foreach---------------------"); for (id item in mutableArray) { NSLog(@"%@",item); } NSLog(@"-------------------while---------------------"); NSUInteger count = 0; while (count < [mutableArray count]) { NSLog(@"%@",[mutableArray objectAtIndex:count]); count++; } NSLog(@"-------------------do-while---------------------"); count = 0; do{ NSLog(@"%@",[mutableArray objectAtIndex:count]); count++; }while (count<[mutableArray count]); NSLog(@"-------------------switch---------------------"); int expression=4; switch (expression) { case 1: NSLog(@"expression=1"); break; case 2: NSLog(@"expression=2"); break; default: NSLog(@"expression=default"); break; } return 0; }