I wonder how code formatting works? Here are a couple of samples:
#import <Foundation/Foundation.h>
int main(int argc, char* argv[]) {
for (NSInteger i=1; I <= 101; i++) {
if (i % 15 == 0) {
NSLog(@"FizzBuzz\n");
} else if (i % 3 == 0) {
NSLog(@"Fizz\n");
} else if (i % 5 == 0) {
NSLog(@"Buzz\n");
} else {
NSLog(@"%li\n", i);
}
}
}
And Swift:
for i in 1...100 {
switch (i % 3, i % 5) {
case (0, 0):
print("FizzBuzz")
case (0, _):
print("Fizz")
case (_, 0):
print("Buzz")
default:
print(i)
}
}