examples: fizz_buzz.v

pull/3576/head
Steve Phillips 2020-01-27 07:56:46 -08:00 committed by Alexander Medvednikov
parent 7a79c94a9e
commit c617cf8e05
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
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 = ''
}
}