1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- # famous fizzbuzz program
- printNum: # prints number <= 100
- $0 100 = ?
- ^
- 0 "100" -->
- !.
- .
- $0 10 >= ?
- $0 10 / "0" + ->
- 10 %
- .
- "0" + ->
- .
- 1 # i (counter)
- @@
- $0 100 > ?
- !@
- .
- $0 1 != ? # print comma before every but first number
- "," -> " " ->
- .
- $0 3 % 0 = $1 5 % 0 = 2 * | # (i % 3 == 0) | ((i % 5 == 0) << 1)
- $0 0 = ?
- $1 printNum
- ;
- $0 1 & ?
- 0 "Fizz" -->
- .
- $0 3 = ?
- " " ->
- .
- $0 2 & ?
- 0 "Buzz" -->
- .
- .
- ^
- ++
- .
- ^
|