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 Yorick

Date:04/20/05
Author:Eric Korpela
URL:n/a
Comments:0
Info:n/a
Score: (2.46 in 13 votes)
/*  The Bottles of Beer song (c) 1996 Eric Korpela
 *   Yorick version-- Modeled after the IDL version.
 * USAGE:  bottles or bottles, number
 */

/* Set up our song structure............ */

struct _song {
  int n0;
  string s1;
  int n1;
  string s2,s3;
  int n2;
  string s4;
} 

func bottles( number )
{

  if (is_void(number)) { 
    number=99
    write,"BOTTLES: Defaulting to 99 bottles!"
  }
 
  song=array(_song(n0=0,s1=" bottles of beer on the wall.\n",n1=0,
                   s2=" bottles of beer.\n",
                   s3="You take one down and pass it around\n",
                   n2=0,
                   s4=" bottles of beer on the wall.\n"), number)

  /* put in the appropriate numbers */

  i=(number)-indgen(number)
  song(*).n0=i+1
  song(*).n1=i+1
  song(*).n2=i
 
  write,song.n0,song.s1,song.n1,song.s2,song.s3,song.n2,song.s4
 
}

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: