error check with multi-word variables
Author |
Message |
batgirl13
|
Posted: Thu Dec 04, 2008 8:08 pm Post subject: error check with multi-word variables |
|
|
hi,
im making a simple program; here is a section of the code.
code: |
loop
put "Would you like to enter? Y/N" ..
get ans
if ans = Y then
exit
elsif ans = N then
quit
else
put ans, " is not a correct response."
end if
end loop
|
at the moment, if you enter more than 1 word, it will display the error message once for every word. i need it to display once, showing all words that may have been entered. i know this is a simple fix, but i cant remember how to do it...help would be much appreciated.  |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Zren

|
Posted: Thu Dec 04, 2008 8:20 pm Post subject: Re: error check with multi-word variables |
|
|
I think it's:
You might also wonna watch out for Y & N since they appear to be strings be sure to add the "Y". |
|
|
|
|
 |
andrew.
|
Posted: Thu Dec 04, 2008 11:25 pm Post subject: RE:error check with multi-word variables |
|
|
Zren is right. Just add : * after your get line.
And yeah, you definitely have to change it from saying if ans = Y to if ans = "Y". |
|
|
|
|
 |
Tyr_God_Of_War
|
Posted: Thu Dec 04, 2008 11:30 pm Post subject: RE:error check with multi-word variables |
|
|
And if you use index it will sort through the response for a phrase. I will post an example if you want. |
|
|
|
|
 |
batgirl13
|
Posted: Thu Dec 04, 2008 11:45 pm Post subject: RE:error check with multi-word variables |
|
|
ahh, thank you, knew it was something easy
and thanks for the "" as well, i had those in the original program but forgot to type them in. |
|
|
|
|
 |
|
|