Language Kaya
Date: | 04/21/10 |
Author: | Jost Stricker |
URL: | http://www.strickerz.dk |
Comments: | 1 |
Info: | http://kayalang.org |
Score: | (3.33 in 3 votes) |
/* * 99 Bottles of Beer - in Kaya * by Jost Stricker | http://www.strickerz.dk * anno 2010 */ program bottles; import Regex; data Bottle = newBottle(Int number); data Wall = newWall([Bottle] bottles); Void main() { b = []; for(i = 99; i > 0; i--) { push(b, newBottle(i)); } wall = newWall(b); do { removeBottle(wall); } while(bottlesOnTheWall(wall)); } Void removeBottle(Wall w) { b = shift(w.bottles); sing(b); } Bool bottlesOnTheWall(Wall w) { if(size(w.bottles) > 0) { return true; } else { return false; } } Void sing(Bottle b) { if(b.number > 1) { plural = "s"; if(b.number != 2) { str = "Take one down and pass it around, 99 bottles of beer on the wall."; } else { str = "Take one down and pass it around, 99 bottle of beer on the wall."; } } else { plural = ""; str = "Take one down and pass it around, no more bottles of beer on the wall."; end = "No more bottles of beer on the wall, no more bottles of beer. \nGo to the store and buy some more, 99 bottles of beer on the wall."; } putStrLn(b.number + " bottle" + plural + " of beer on the wall, " + b.number + " bottle" + plural + " of beer."); replace("99", String(b.number - 1), str); putStrLn(str + "\n"); if(length(end) > 0) { putStrLn(end); } }
Download Source | Write Comment
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
DeborahSCHWARTZ18 said on 08/02/10 17:42:38
When you are in uncomfortable position and have no cash to move out from that, you would require to take the <a href="http://bestfinance-blog.com/topics/business-loans">business loans</a>. Just because it should aid you unquestionably. I get commercial loan every year and feel fine because of this.