Merge pull request #1075 from flaviut/inlinedocs

Add some documentations and code examples in system
This commit is contained in:
Andreas Rumpf 2014-04-09 22:56:18 +02:00
commit a690e7b267
71 changed files with 2521 additions and 15 deletions

36
tests/misc/t99bott.nim Normal file
View file

@ -0,0 +1,36 @@
discard """
file: "t99bott.nim"
line: 26
errormsg: "cannot evaluate at compile time: bn"
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."