1
0
dust/examples/fizzbuzz.ds

35 lines
504 B
Plaintext
Raw Normal View History

2023-10-06 12:17:37 +00:00
fizzbuzz_basic = function <limit> {
count = 1
while count < limit {
count += 1
if count % 3 == 0 && count % 5 == 0 {
output 'fizzbuzz'
} else {
if count % 3 == 0 {
output 'fizz'
}
if count % 5 == 0 {
output 'buzz'
}
}
}
}
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>