Click to See Complete Forum and Search --> : need help with while loop


dan1
04-21-2006, 03:22 AM
:confused: Please if anybody could help me with this it would be muchly appreciated.

I am a student and need all the help I can get

Question:

Use a while loop to see if a user inputs the correct word. The word will be “cash”. When a user enters the wrong word, a message will momentarily appear stating: “&%$#@ is the wrong word”. When the correct word is entered, the message “cash is the correct word” will appear. Assume all input is in lower case.

Thanks for your help!!

Dan

jalarie
04-21-2006, 07:34 AM
Done='no';
while (Done == 'no') {
InWord=prompt("What's the word?",'');
if (InWord == 'cash') {
alert('cash is the correct word');
Done='yes';
} else {
alert(InWord+' is the wrong word');
}
}