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 NIT

Date:01/17/11
Author:ig0r
URL:n/a
Comments:0
Info:http://nitlanguage.org/
Score: (3.33 in 3 votes)
fun bottles(n: Int) : String
do
   if n == 0 then 
      return "No more bottles of beer" 
   else if n == 1 then
      return "One bottle of beer" 
   else 
      return n.to_s + " bottles of beer"
   end
end

fun beers(n: Int)
do
   print bottles(n) + " on the wall, "
   print bottles(n) + "."
   if n > 0 then
      print "Take one down and pass it around, "
      print bottles(n-1) + " on the wall.\n"
   else
      print "Go to the store and buy some more, "
      print bottles(99) + " on the wall.\n"
   end
end

var l = [1..100]
l.iterate !each(i) do beers(100-i)

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: