RosettaCode: Guess the Number
authorIstvan SZALAI <szalai972@gmail.com>
Wed, 10 Jun 2015 17:57:42 +0000 (13:57 -0400)
committerJean Privat <jean@pryen.org>
Wed, 17 Jun 2015 13:32:00 +0000 (09:32 -0400)
Close #1476

Signed-off-by: Istvan SZALAI <szalai972@gmail.com>

examples/rosettacode/guess_the_number.nit [new file with mode: 0644]

diff --git a/examples/rosettacode/guess_the_number.nit b/examples/rosettacode/guess_the_number.nit
new file mode 100644 (file)
index 0000000..52c8e98
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env nit
+#
+# This file is part of NIT ( http://www.nitlanguage.org ).
+# This program is public domain
+
+# Task: guess the number
+# SEE: <http://rosettacode.org/wiki/Guess_the_number>
+#
+
+var random = 10.rand +1
+var str = 0
+while str != random do
+       print "enter a guess :"
+       str = gets.to_i
+       if str == random then print "Well guessed"
+end