blob: 7ebfd61e9c8b094f5fc6099d4cb7b2c688983541 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
discard """
file: "t99bott.nim"
line: 26
errormsg: "constant expression expected"
disabled: false
"""
## 99 Bottles of Beer
## http://www.99-bottles-of-beer.net/
## Nimrod version
## Author: Philippe Lhoste <PhiLho(a)GMX.net> http://Phi.Lho.free.fr
# 2012-11-25
# Loosely based on my old Lua version... Updated to current official lyrics.
proc GetBottleNumber(n: int): string =
var bs: string
if n == 0:
bs = "No more bottles"
elif n == 1:
bs = "1 bottle"
else:
bs = $n & " bottles"
return bs & " of beer"
for bn in countdown(99, 1):
const cur = GetBottleNumber(bn)
echo(cur, " on the wall, ", cur, ".")
echo("Take one down and pass it around, ", GetBottleNumber(bn-1),
" on the wall.\n")
echo "No more bottles of beer on the wall, no more bottles of beer."
echo "Go to the store and buy some more, 99 bottles of beer on the wall."
|