Anonymous user
99 Bottles of Beer/Tcl: Difference between revisions
m
add headers
m (Add SMW link) |
m (add headers) |
||
Line 1:
{{collection|99 Bottles of Beer}} [[implementation of task::99 Bottles of Beer| ]]
===99-bottles-of-beer.net===
from http://99-bottles-of-beer.net/language-tcl-439.html
<lang tcl>proc bottles {i} {
Line 22 ⟶ 23:
}</lang>
===using variable traces===
Here's a version that uses Tcl's variable traces to set a global "bottle string" whenever the counter variable is set.▼
Here's a version that uses Tcl's variable traces
▲
<lang tcl>proc setBottles {varName args} {
upvar #0 $varName n
Line 37 ⟶ 40:
puts "$bottles of beer on the wall\n"
}</lang>
===The Boozy Version===
A [http://99-bottles-of-beer.net/language-expect-249.html
particularly entertaining version] is [[wp:Don Libes|Don Libes]]’s coding
from the mid-'90s in [[Expect]],
which "... SIMULATES a human typing the beer song."
This is a version of that code, adapted to use modern coding styles,
and not require any extensions.<br>
{{works with|Tcl|8.4}}
<lang tcl># 99 bottles of beer on the wall, Expect-style
|