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 IDL

Date:04/20/05
Author:Eric Korpela
URL:n/a
Comments:1
Info:n/a
Score: (2.68 in 19 votes)
; The Bottles of Beer song (c) 1996 Eric Korpela (korpela@ssl.berkeley.edu)
; USAGE:  BOTTLES or BOTTLES, NUMBER
;
pro bottles, number
;
if not(keyword_set(number)) then begin
  number=99
  print,'BOTTLES: Defaulting to 99 bottles!'
endif
;
; Set up our song structure............
st1=replicate({n0:0,s1:' bottles of beer on the wall.',          $
               n1:0,s2:' bottles of beer.',                      $
               s3:'You take one down and pass it around.',       $
               n2:0,s4:' bottles of beer on the wall.'}, number)
;
; put in the appropriate numbers
i=(number-1)-indgen(number)
st1(*).n0=i+1
st1(*).n1=i+1
st1(*).n2=i
;
print,st1,format='(i3,a/i3,a/a/i3,a//)'
;

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
An example using IDL's array mappingRüdiger Kupper04/08/080

Comments

>>  gs said on 03/02/06 22:43:09

gs It does prodcue all the correct lyrics, but the line spacing is not handled correctly. So I rated the program as 4.

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: