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 Ruri

Date:04/20/05
Author:Tom Rothamel
URL:n/a
Comments:0
Info:http://onegeek.org/~tom/software/ruri/
Score: (3.00 in 3 votes)
// Ruri version of 99 Bottles of beer.
// By Tom Rothamel <tom-ijvm@onegeek.org>
// 
// See http://onegeek.org/~tom/software/ruri/ for more info on the
// language.

main {
	word i;

	for (i = 99; i > 0; i) {
		printbottlesob(i);
		out " on the wall,\n";
		printbottlesob(i);
		out ".\n";
		
		i = i - 1;
		out "Take one down, pass it around,\n";
		printbottlesob(i);
		out " on the wall.\n\n";
	}

	halt;
}

method printbottlesob(word n) {
	word q;
	word oldn;

	oldn = n;

	if (n > 0) {
		q = 0;

		while (n >= 10) {
			n = n - 10;
			q = q + 1;
		}
	
		if (q) out '0' + q;
		out '0' + n;
	} else {
		out "No";
	}
		
	out " bottle";
	
	if (oldn != 1) out "s";
	
	out " of beer";

	return 0;
}

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: