Hi Brannon, 

I'm sure you've figured it out by now. In case you're still surprised:

you wrote:
>In the program below, the print stmt: print join "Hello" name
>does not occur until after the 2nd ask even though it is coded before the
>2nd ask
[snip]
>name:  ask "What is your name? "

Here you are not setting name: to represent the instruction sequence ask
... Instead you are setting the word name to the value returned by
executing ask ...
After this instruction has been process, name references a string
containing whatever it was you entered.

>guess: ask "What is the secret word? "
>

Same thing. Ask has been executed at this point. Now, guess references a
string containing whatever you guessed.

>either equal? name "Randal"

Here you are not calling name, forcing ask to be executed. That's already
happened above. Here you are simply comparing the string referenced by the
word name to the string "Randal". 

I believe what you thought you were doing was:

name: func [] [ ask "What is your name? " ]
guess: func [] [ask "What is the secret word? "]

Here name and guess are references to a function that will not be executed
until either name or guess is called. Now you can say

either equal? name "Randal"
 [ print "Hi Randal! How good of you to be here!" ]
 [ print join "Hello " name "."                   ]

either equal? guess secret-word
 [ print "That's it!!!! You got it!!!" ]
 [ print "You loser. That's just not right." ]

and the prompts will appear in the sequence you expected, i.e. first the
user will be asked for his name, then the response will be printed, then
the user will be asked for the secret password.

Hope this helps,

Elan

Reply via email to