Improved fizzbuzz example
This commit is contained in:
parent
3ad9510421
commit
f9ff83136a
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user