File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1
1
// Last checked with Xcode Version 11.4.1 (11E503a)
2
2
3
+
4
+ /**
5
+ * This function takes in an integer numberOfTurns as an input and prints out the numbers from 1 to numberOfTurns with the following modification:
6
+ * - If the number is divisible by 3, it prints "Fizz" instead of the number
7
+ * - If the number is divisible by 5, it prints "Buzz" instead of the number
8
+ * - If the number is divisible by both 3 and 5, it prints "Fizz Buzz" instead of the number
9
+ * - If the numberOfTurns is less than 1, it will print "Number of turns must be >= 1"
10
+ *
11
+ * - parameter numberOfTurns: the number of turns for the fizzbuzz game
12
+ */
13
+
14
+
3
15
func fizzBuzz( _ numberOfTurns: Int ) {
4
16
guard numberOfTurns >= 1 else {
5
17
print ( " Number of turns must be >= 1 " )
@@ -18,4 +30,4 @@ func fizzBuzz(_ numberOfTurns: Int) {
18
30
print ( " Fizz Buzz " )
19
31
}
20
32
}
21
- }
33
+ }
You can’t perform that action at this time.
0 commit comments