Conlang/sample-code/fizzbuzz.cl
2024-04-19 10:49:25 -05:00

21 lines
432 B
Common Lisp

// FizzBuzz, using the unstable variadic-`print` builtin
fn main() {
fizzbuzz(10, 20)
}
// Outputs FizzBuzz for numbers between `start` and `end`, inclusive
fn fizzbuzz(start: i128, end: i128) {
for x in start..=end {
print(if x % 15 == 0 {
"FizzBuzz"
} else if 0 == x % 3 {
"Fizz"
} else if x % 5 == 0 {
"Buzz"
} else {
x
})
}
}