RosettaCodeData/Task/Guess-the-number/Fantom/guess-the-number.fantom
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

20 lines
395 B
Text

class Main
{
public static Void main ()
{
Str target := (1..10).random.toStr
Str guess := ""
while (guess != target)
{
echo ("Enter a guess: ")
guess = Env.cur.in.readLine
if (guess.trim == target) // 'trim' to remove any spaces/newline
{
echo ("Well guessed!")
break
}
else
echo ("Failed - try again")
}
}
}