1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- Bottles of beer song example written in Cod
include "std/io.cod"
include "std/math.cod"
include "std/stack.cod"
-- Strings used in the song
alias song_p1 "of beer on the wall, "
alias song_p2 "of beer.\nTake one down and pass it around, "
alias song_p3 "of beer on the wall.\n\n"
alias song_p4 "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n"
alias bottle_plural " bottles "
alias bottle_singular " bottle "
-- Will print bottle or bottles, depending
-- on how many bottles left
subroutine print_bottles {
dup 1 > if {
bottle_plural prints
} pop
dup 1 == if {
bottle_singular prints
} pop
Enter to Rename, <Shift>+Enter to Preview