examples: cleanup examples/fizz_buzz.v

This commit is contained in:
Delyan Angelov 2024-01-27 19:15:37 +02:00
parent 5a752c9a2d
commit 49aa602fe5
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED

View file

@ -1,17 +1,8 @@
fn main() {
mut s := ''
for n in 1 .. 101 {
if n % 3 == 0 {
s += 'Fizz'
}
if n % 5 == 0 {
s += 'Buzz'
}
if s == '' {
println(n)
} else {
println(s)
}
s = ''
}
println(match true {
n % 15 == 0 { 'FizzBuzz' }
n % 5 == 0 { 'Buzz' }
n % 3 == 0 { 'Fizz' }
else { n.str() }
})
}