Richard Hart

Head of Something @ Somewhere
Kent, UK

My Music
My Photos

LinkedIn
Mastodon

Objective-C FizzBuzz

    int main (int argc, const char * argv[]) {
        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
        for(int i = 0; i < 100; i++) {
            NSMutableString * fizzbuzz = [[NSMutableString alloc] init];
            if(i % 3 == 0) {
                [fizzbuzz appendString:@"Fizz"];
            }
            if(i % 5 == 0) {
                [fizzbuzz appendString:@"Buzz"];
            }
            NSLog(fizzbuzz);
            [fizzbuzz autorelease];
        }
        [pool drain];
        return 0;
    }

We have lift off!