Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language Nice

Date:05/22/05
Author:Manfred Kröhnert
URL:n/a
Comments:0
Info:http://nice.sourceforge.net
Score: (2.00 in 4 votes)
/**
 *
 * Nice Version of 99 Bottles of beer
 * http://nice.sourceforge.net
 * File: beer.nice
 * Author: Manfred Kröhnert
 * Mail: Manfred.Kroehnert@ira.uka.de
 * Usage: put file into a directory named beer
 *        call: 'nicec -a beer.jar beer'
 *        to compile the program into a .jar file
 *        execute by calling 'java -jar beer.jar'
 *
 */

package beer;

String beer(int n) requires n >= 0;

beer(0) = "No more beer";

beer(1) = """
1 bottle of beer on the wall,
1 bottle of beer.
Take one down, pass it around,
0 bottles of beer on the wall.""";

beer(n) = 
n + " bottles of beer on the wall,\n" +
n + " bottles of beer.\n" +
"Take one down, pass it around,\n" +
(n - 1) + " bottles of beer on the wall.\n";

void main(String[] args){
  for(int i: 0..99) println(beer(99 - i));
}

Download Source | Write Comment

Alternative Versions

Comments

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!

Name:

eMail:

URL:

Security Code:
  
Comment: