mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
examples: cleanup examples/fizz_buzz.v
This commit is contained in:
parent
5a752c9a2d
commit
49aa602fe5
1 changed files with 7 additions and 16 deletions
|
@ -1,17 +1,8 @@
|
||||||
fn main() {
|
for n in 1 .. 101 {
|
||||||
mut s := ''
|
println(match true {
|
||||||
for n in 1 .. 101 {
|
n % 15 == 0 { 'FizzBuzz' }
|
||||||
if n % 3 == 0 {
|
n % 5 == 0 { 'Buzz' }
|
||||||
s += 'Fizz'
|
n % 3 == 0 { 'Fizz' }
|
||||||
}
|
else { n.str() }
|
||||||
if n % 5 == 0 {
|
})
|
||||||
s += 'Buzz'
|
|
||||||
}
|
|
||||||
if s == '' {
|
|
||||||
println(n)
|
|
||||||
} else {
|
|
||||||
println(s)
|
|
||||||
}
|
|
||||||
s = ''
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue