From: Istvan SZALAI Date: Wed, 10 Jun 2015 17:57:42 +0000 (-0400) Subject: RosettaCode: Guess the Number X-Git-Tag: v0.7.6~26^2~3 X-Git-Url: http://nitlanguage.org RosettaCode: Guess the Number Close #1476 Signed-off-by: Istvan SZALAI --- diff --git a/examples/rosettacode/guess_the_number.nit b/examples/rosettacode/guess_the_number.nit new file mode 100644 index 0000000..52c8e98 --- /dev/null +++ b/examples/rosettacode/guess_the_number.nit @@ -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: +# + +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