a working version of 99 bottles

This commit is contained in:
Dmitry Jemerov
2011-04-14 18:21:19 +02:00
parent 511ba94611
commit 1d01d519b9
+23
View File
@@ -0,0 +1,23 @@
namespace bottles;
fun main(args: Array<String>) {
var bottles: Int = 99;
while(bottles > 0) {
System.out?.print(bottles)
System.out?.print(if (bottles > 1) " bottles" else " bottle")
System.out?.print(" of beer on the wall, ")
System.out?.print(bottles)
System.out?.print(if (bottles > 1) " bottles" else " bottle")
System.out?.println(" of beer.")
System.out?.print("Take one down, pass it around, ")
bottles -= 1;
if (bottles == 0) {
System.out?.print("no more bottles of beer on the wall.")
}
else {
System.out?.print(bottles)
System.out?.print(if (bottles > 1) " bottles" else " bottle")
System.out?.println(" of beer on the wall.")
}
}
}