I think this is what you're trying to do... don't see any need for the
unset, either.
secret-word: "llama"
name: ask "What is your name? "
either equal? name "Randal"
[ print "Hi Randal! How good of you to be here!" ]
[ print ["Hello" name "." ]]
while [not equal? guess: ask "What is the secret word? " secret-word]
[ print "Wrong loser. Try again."
; unset 'guess
]
print "That's it!!!! You got it!!!"
----------------------------------------
Perhaps a bit more in line with the approach you were attempting, you might
do this:
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? reform guess secret-word]
[ print "Wrong loser. Try again."
;unset 'guess
]
print "That's it!!!! You got it!!!"
-----------------------good luck-----------------
At 07:59 PM 10/11/99 -0700, you 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 [
> Title: "Guessing the secret word"
> Date: 11-Oct-99
> Author: "T.M. Brannon"
> Email: [EMAIL PROTECTED]
> File: %guessing-word.r
> Purpose: {
> Play a guessing game
> }
> Category: [file script utility]
>]
>
>
>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!!!"
>