Improved fizzbuzz example

This commit is contained in:
Eduard Urbach 2024-08-04 00:00:26 +02:00
parent 3ad9510421
commit f9ff83136a
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0

View File

@ -10,18 +10,10 @@ fizzbuzz(n) {
loop { loop {
switch { switch {
x % 15 == 0 { x % 15 == 0 { print("FizzBuzz", 8) }
print("FizzBuzz", 8) x % 5 == 0 { print("Buzz", 4) }
} x % 3 == 0 { print("Fizz", 4) }
x % 5 == 0 { _ { log.number(x) }
print("Buzz", 4)
}
x % 3 == 0 {
print("Fizz", 4)
}
_ {
log.number(x)
}
} }
x += 1 x += 1