1
0
dust/examples/fizzbuzz.ds
2023-10-06 21:59:01 -04:00

32 lines
518 B
Plaintext

fizzbuzz_basic = function <limit> {
count = 1
while count < limit {
if count % 3 == 0 && count % 5 == 0 {
(output 'fizzbuzz')
} else f count % 3 == 0 {
(output 'fizz')
} else if count % 5 == 0 {
(output 'buzz')
} else
(output count)
count += 1
}
}
fizzbuzz_match <limit> {
count = 1
while count < 1 {
output match [count % 3 == 0, count % 5 == 0] {
[true, false] => 'fizz'
[false, true] => 'buzz'
[true, true] => 'fizzbuzz'
}
}
}
fizzbuzz_basic<15>
fizzbuzz_match<15>