Created
July 5, 2015 23:39
-
-
Save cquinn/9b106842cec90460ef19 to your computer and use it in GitHub Desktop.
Minimalistic FizzBuzz in Pony lang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use "collections" | |
actor Main | |
new create(env: Env) => | |
try | |
let n = env.args(1).i32() | |
for i in Range[I32](1, n) do | |
env.out.print(fizzbuzz(i)) | |
end | |
end | |
fun fizzbuzz(n: I32): String => | |
if (n % 15) == 0 then | |
"FizzBuzz" | |
elseif (n % 5) == 0 then | |
"Buzz" | |
elseif (n % 3) == 0 then | |
"Fizz" | |
else | |
n.string() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment