lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I just noticed that Lua wasn't represented in the "99 Bottles of Beer on the
Wall" compendium at [1]. I'm not a Lua expert by any means:-) --- this is the
first program I've actually written in Lua. Yowza. I just sent this
contribution off to the maintainer. Any suggestions from you all, that would
make it clearer, or safer, or better, or more idiomatic Lua?

-Bennett

[1] <URL:http://www.ionet.net/%7etimtroyr/funhouse/beer.html>

-- 99 bottles in Lua <URL:http://www.tecgraf.puc-rio.br/lua/>
-- written 1998-12-30 by Bennett Todd <bet@mordor.net>

n=99
while n>1 do
	write(n, " bottles of beer on the wall, ", n, " bottles of beer,\n")
	write("Take one down, pass it around, ")
	n=n-1
	if n>1 then
		write(n, " bottles of beer on the wall.\n")
	else
		write("one last bottle of beer on the wall.\n")
	end
end
write("One bottle of beer on the wall, one bottle of beer,\n")
write("Take it down, pass it around, no more bottles of beer on the wall.\n")