|
|
há 3 anos atrás | |
|---|---|---|
| .. | ||
| Sources | há 3 anos atrás | |
| Tests | há 3 anos atrás | |
| .gitignore | há 3 anos atrás | |
| Package.swift | há 3 anos atrás | |
| README.md | há 3 anos atrás | |
This package solves the famous FizzBuzz problem.
let fbkit = FizzBuzzKit()
var result = fbkit.handle(number: 3) // "Fizz"
result = fbkit.handle(number: 4) // "4"
result = fbkit.handle(number: 5) // "Buzz"
result = fbkit.handle(number: 15) // "FizzBuzz"
let fbkit = FizzBuzzKit()
let result = fbkit.handle(numbers: [1, 7, 30, 3]) // ["1", "7", "FizzBuzz", "Fizz"]
let fbkit = FizzBuzzKit(rules: [(7, "Potato"), (11, "Tomato")])
var result = fbkit.handle(number: 7) // "Potato"
result = fbkit.handle(number: 4) // "4"
result = fbkit.handle(number: 11) // "Tomato"