1
<?xml version="1.0" encoding="UTF-8"?>
3
<header>Tcl code</header>
4
<para>Example tcl code</para>
5
<code xml:whitespace="preserve" language="tcl">
9
# 99.tcl; Tcl version of 99 Bottles of Beer Song
11
proc findBString { count } {
12
return [switch -exact -- $count {
13
0 { expr {"No more bottles"} }
14
1 { expr {"1 bottle"} }
15
default { expr {"$count bottles"} }
20
set bString [findBString $bottles]
21
while {$bottles + 1} {
22
puts "$bString of beer on the wall. $bString of beer."
25
set bString [findBString $bottles]
26
puts "Take one down, pass it round, $bString of beer on the wall.\n"
28
puts "Go to the store and buy some more...99 bottles of beer."
33
<para>Origin: http://www.99-bottles-of-beer.net/language-tcl-797.html</para>
34
<para>Additional examples</para>
35
<code xml:whitespace="preserve" language="tcl">
37
# keywords starting with an '-' are not keyword
38
proc -proc { -switch } {
39
switch -exact -- $-switch {
40
0 { expr {"No more bottles"} }
41
1 { expr {"1 bottle"} }
42
default { expr {"$count bottles"} }
b'\\ No newline at end of file'