Files
LM-Gambit/tests/test1.txt
T

15 lines
627 B
Plaintext

Write a Swift function that solves the FizzBuzz problem.
The function must have the exact signature:
`func generateFizzBuzz(upTo max: Int) -> [String]`
It must not print directly to the console. Instead, it should return an array of strings.
Rules:
1. For numbers divisible by 3, the string should be "Fizz".
2. For numbers divisible by 5, the string should be "Buzz".
3. For numbers divisible by both 3 and 5, the string should be "FizzBuzz".
4. Otherwise, it should be the number itself as a string.
Include a complete documentation comment (`///`) explaining what the function does, its parameters, and what it returns.