lots o fixes
This commit is contained in:
19
examples/fizzbuzz.m
Normal file
19
examples/fizzbuzz.m
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env monkey-lang
|
||||
|
||||
test := fn(n) {
|
||||
if (n % 15 == 0) {
|
||||
return "FizzBuzz"
|
||||
} else if (n % 5 == 0) {
|
||||
return "Buzz"
|
||||
} else if (n % 3 == 0) {
|
||||
return "Fizz"
|
||||
} else {
|
||||
return str(n)
|
||||
}
|
||||
}
|
||||
|
||||
n := 1
|
||||
while (n <= 100) {
|
||||
println(test(n))
|
||||
n = n + 1
|
||||
}
|
||||
Reference in New Issue
Block a user