#!/usr/local/bin/swift class FizzBuzz { subscript (n:Int)->String { if n % 15 == 0 { return "FizzBuzz" } if n % 5 == 0 { return "Buzz" } if n % 3 == 0 { return "Fizz" } return String(n) } } let fizzbuzz = FizzBuzz() for n in 1...100 { print(fizzbuzz[n]) }