diff --git a/Fizz Buzz/FizzBuzz.swift b/Fizz Buzz/FizzBuzz.swift index bf753e648..8c5bb7aeb 100644 --- a/Fizz Buzz/FizzBuzz.swift +++ b/Fizz Buzz/FizzBuzz.swift @@ -1,5 +1,17 @@ // Last checked with Xcode Version 11.4.1 (11E503a) + +/** +* This function takes in an integer numberOfTurns as an input and prints out the numbers from 1 to numberOfTurns with the following modification: +* - If the number is divisible by 3, it prints "Fizz" instead of the number +* - If the number is divisible by 5, it prints "Buzz" instead of the number +* - If the number is divisible by both 3 and 5, it prints "Fizz Buzz" instead of the number +* - If the numberOfTurns is less than 1, it will print "Number of turns must be >= 1" +* +* - parameter numberOfTurns: the number of turns for the fizzbuzz game +*/ + + func fizzBuzz(_ numberOfTurns: Int) { guard numberOfTurns >= 1 else { print("Number of turns must be >= 1") @@ -18,4 +30,4 @@ func fizzBuzz(_ numberOfTurns: Int) { print("Fizz Buzz") } } -} \ No newline at end of file +}