Skip to content

Commit 9359716

Browse files
authored
Add Fizz Buzz in Pony (#4367)
1 parent 1d7c6be commit 9359716

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

archive/p/pony/fizz-buzz.pony

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use "collections"
2+
3+
actor Main
4+
new create(env: Env) =>
5+
for i in Range[I32](1, 101) do
6+
env.out.print(fizzbuzz(i))
7+
end
8+
9+
fun fizzbuzz(n: I32): String =>
10+
if (n % 15) == 0 then
11+
"FizzBuzz"
12+
elseif (n % 5) == 0 then
13+
"Buzz"
14+
elseif (n % 3) == 0 then
15+
"Fizz"
16+
else
17+
n.string()
18+
end

0 commit comments

Comments
 (0)