Language Tcl
(alternative version)
Date: | 07/14/05 |
Author: | mackenga |
URL: | http://www.radicalabacus.org/ |
Comments: | 0 |
Info: | http://www.tcl.tk |
Score: | (3.79 in 169 votes) |
#!/usr/bin/tclsh # 99.tcl; Tcl version of 99 Bottles of Beer Song proc findBString { count } { return [switch -exact -- $count { 0 { expr {"No more bottles"} } 1 { expr {"1 bottle"} } default { expr {"$count bottles"} } }] } set bottles 99 set bString [findBString $bottles] while {$bottles + 1} { puts "$bString of beer on the wall. $bString of beer." incr bottles -1 if {$bottles + 1} { set bString [findBString $bottles] puts "Take one down, pass it round, $bString of beer on the wall.\n" } else { puts "Go to the store and buy some more...99 bottles of beer." } }
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments