Example Programs/99 Bottles of Beer

From FizzFuzz

Jump to: navigation, search
/*
 * Author: Timothy "Popisfizzy" Reilly
 * Date: August 12, 2008
 * Usage: A "99 Bottles of Beer on the Wall" program.
 *
 */
 
#include <std.dflt.*>
using environment.output()
using environment.outputln()
 
void main()
    int bottles = 99
 
    do
        outputln("[bottles] bottle[bottles > 1 ? 's' : ''] of beer on the wall, [bottles]" + 
            bottle[bottles > 1 ? 's' : '']. of beer")
 
        output("Take one down and pass it around, ")
        if(bottles > 1)
            output("[bottles - 1] bottle[(bottles - 1) > 1 ? 's' : '']")
        else
            output("no more bottles")
        outputln(" of beer on the wall.\n")
 
    while((--bottles) > 0)
 
    outputln("No more bottles of beer on the wall, no more bottles of beer.")
    outputln("Go to the store and buy some more, 99 bottles of beer on the wall.")
Personal tools
Navigation
functions
language