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 Dart

Date:10/13/11
Author:houmei
URL:n/a
Comments:0
Info:http://http://www.dartlang.org/
Score: (2.00 in 3 votes)
class Bottle {
  var b1 = 'bottle' ;
  var b2 = 'bottles' ;

  number(n) {
    return (n==1)? b1 : b2 ;
  }
}


class BoB {

  number(n,lq) {
    var bottle = new Bottle() ;
    int nn = n - 1 ;
    String bn = bottle.number(n) ;
    String bnn = bottle.number(nn) ;
    switch(n) {
    case 0:
      print('No more $bn of $lq on the wall, no more $bn of $lq.') ;
      break ;
    case 1:
      print('1 $bn of $lq on the wall, 1 $bn of $lq.');
      break ;
    default:
      print('$n $bn of $lq on the wall, $n $bn of $lq.');
      print('Take one down and pass it around, $nn $bnn of $lq on the wall.');
    }
  }
}


main() {
  var bob = new BoB() ;
  for (int b = 99; b >= 0; b--) {
    bob.number(b,'beer');
  }
}

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
Class used versionJimin Park10/12/110
An object oriented version of the song.Ville Saalo10/15/110

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: