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 STATA

(Works correctly! More language features.)

Date:04/23/06
Author:Jack Gibson
URL:n/a
Comments:0
Info:http://www.stata.com
Score: (2.65 in 92 votes)
/* 99 Bottles of Beer
   By Jack Gibson.
   This is for STATA, a statistical analysis package
   with a powerful built-in programming system 

   NB. Three slashes just means "command continues on next line"

*/

set more off

foreach n of numlist 99/1 {
	if `n'==1 {
		display "1 bottle of beer on the wall, 1 bottle of beer."
		display "Take it down and pass it around, " ///
			"no more bottles of beer on the wall."
		display " "
		display "No more bottles of beer on the wall," ///
			" no more bottles of beer."
		display "Go to the store and buy some more," ///
			" 99 bottles of beer on the wall."
		display " "
	}
	else {
		if `n'==2 {
			display `n' " bottles of beer on the wall, " ///
				 `n' " bottles of beer."
			display "Take one down and pass it around," ///
				" 1 bottle of beer on the wall."
			display " "
		}
		else {
			display `n' " bottles of beer on the wall, " ///
				 `n' " bottles of beer."
			display "Take one down and pass it around, " ///
				`n'-1 " bottles of beer on the wall."
			display " "
		}
	}
}

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: