1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/examples/fizz_buzz.v

18 lines
192 B
V
Raw Normal View History

2020-01-27 18:56:46 +03:00
fn main() {
2020-03-21 11:47:38 +03:00
mut s := ''
for n in 1 .. 101 {
if n % 3 == 0 {
s += 'Fizz'
}
if n % 5 == 0 {
s += 'Buzz'
}
if s == '' {
println(n)
2021-02-23 20:43:44 +03:00
} else {
2020-03-21 11:47:38 +03:00
println(s)
}
s = ''
}
2020-01-27 18:56:46 +03:00
}