[EMAIL PROTECTED] wrote:
> 
> I can't seem to do anything which allows a loop to keep asking for a word
> until the user inputs the right word. I have tried many different things and
> they all fail. Program included below.
> 
> REBOL [] ; snipped for space
> 
> secret-word: "llama"
> 
> name:  ask "What is your name? "
> guess: ask "What is the secret word? "
> 
> either equal? name "Randal"
>  [ print "Hi Randal! How good of you to be here!" ]
>  [ print ["Hello" name "." ]]
> 
> while [not equal? guess secret-word]
>  [ print "Wrong loser. Try again."
>      unset 'guess
>        ]
> 
> print "That's it!!!! You got it!!!"

If you want the program to ask repeatedly, then put 'ask inside the
part of the program that repeats!  Change the 'while... to read

    while [not equal? guess secret-word] [
        print "I'm sorry, that doesn't match. Try again."
        guess: ask "What is the secret word, again? "
    ]

and it works fine.

-jn-

Reply via email to