Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Guess-the-number/Fantom/guess-the-number.fantom
Normal file
20
Task/Guess-the-number/Fantom/guess-the-number.fantom
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue