35 lines
504 B
Plaintext
35 lines
504 B
Plaintext
|
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>
|