From 1d01d519b98d5ab5317217b32658292461fa721f Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 14 Apr 2011 18:21:19 +0200 Subject: [PATCH] a working version of 99 bottles --- examples/src/Bottles.jetl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/src/Bottles.jetl diff --git a/examples/src/Bottles.jetl b/examples/src/Bottles.jetl new file mode 100644 index 00000000000..43d2d0c3b26 --- /dev/null +++ b/examples/src/Bottles.jetl @@ -0,0 +1,23 @@ +namespace bottles; + +fun main(args: Array) { + 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.") + } + } +}