Skip to content

Commit 74f8efb

Browse files
committed
feat(examples): adding fizz buzz and show ascii table examples
1 parent eef1767 commit 74f8efb

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

examples/fizz_buzz.ark

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
(import std.Range)
2+
3+
(let r (range:range 0 100))
4+
(range:forEach
5+
r
6+
(fun (e)
7+
(if (= 0 (mod e 15))
8+
(print "FizzBuzz")
9+
(if (= 0 (mod e 3))
10+
(print "Fizz")
11+
(if (= 0 (mod e 5))
12+
(print "Buzz")
13+
(print e))))))

examples/show_ascii_table.ark

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(mut i 0)
2+
(while (< i 16) {
3+
(mut j (+ 32 i))
4+
(while (< j 128) {
5+
(let k
6+
(if (= 32 j)
7+
"Spc"
8+
(if (= 127 j)
9+
"Del"
10+
(string:chr j))))
11+
(puts (string:format "{:3} : {:<3}" j k))
12+
(set j (+ 16 j)) })
13+
(print "")
14+
15+
(set i (+ 1 i)) })

0 commit comments

Comments
 (0)