FizzBuzz
func FizzBuzz(nums: Number) { for (var i = 1; i <= nums; i += 1) { var fizz = i % 3 == 0 var buzz = i % 5 == 0 if (fizz and buzz) print("FIZZBUZZ") elif (fizz) print("FIZZ") elif (buzz) print("BUZZ") else print(i) }}
FizzBuzz(20)
FizzBuzz is a counting game, but when a number is a multiple of 3, you say FIZZ instead, and if the number is a multiple of 5, you say BUZZ, and if its a multiple of both, you say FIZZBUZZ. In this function, it counts up to the inputed number.