Language Dart
Date: | 10/13/11 |
Author: | houmei |
URL: | n/a |
Comments: | 0 |
Info: | http://http://www.dartlang.org/ |
Score: | (3.03 in 38 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
Version | Author | Date | Comments | Rate |
---|---|---|---|---|
An object oriented version of the song. | Ville Saalo | 10/15/11 | 0 | |
Class used version | Jimin Park | 10/12/11 | 0 |
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!
Comments