Objective-C退出多层循环

NSArray *> *items = @[@[@"1",@"2"], @[@"3",@"4"], @[@"5",@"6"]];
for (NSArray *array in items) {
    for (NSString *item in array) {
        NSLog(@"%@", item);
        if ([item intValue] == 3) {
            // 跳出外层循环
            goto finally;
        }
    }
}

finally: {
    NSLog(@"goto label.");
}

你可能感兴趣的:(Objective-C退出多层循环)