Language LUA
(original version)
| Date: | 04/20/05 |
| Author: | Philippe Lhoste |
| URL: | n/a |
| Comments: | 1 |
| Info: | http://jove.prohosting.com/~philho/ |
| Score: |
-- Lua 99 Bottles of Beer
-- by Philippe Lhoste <PhiLho@GMX.net> http://jove.prohosting.com/~philho/
function PrintBottleNumber(n)
local bs
if n == 0 then
bs = "No more bottles"
elseif n == 1 then
bs = "One bottle"
else
bs = n .. " bottles"
end
return bs .. " of beer"
end
for bn = 99, 1, -1 do
write(PrintBottleNumber(bn), " on the wall, \n")
write(PrintBottleNumber(bn), "\n")
write("Take one down and pass it around,\n")
write(PrintBottleNumber(bn-1), " on the wall, \n\n")
end
write("No more bottles of beer on the wall,\nNo more bottles of beer\n")
write("Go to the store, buy some more!\n")
Download Source | Write Comment
Alternative Versions
| Version | Author | Date | Comments | Rate |
|---|---|---|---|---|
| 5.1, bottled | Peter Cawley | 04/19/09 | 0 | |
| Examples of metatables in lua 5.1 | Peter Cawley | 06/07/07 | 0 | |
| version 5.x | chill | 07/10/05 | 2 |
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