
-----------------------------------
batgirl13
Thu Dec 04, 2008 8:08 pm

error check with multi-word variables
-----------------------------------
hi, 
im making a simple program; here is a section of the 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. :)

-----------------------------------
Zren
Thu Dec 04, 2008 8:20 pm

Re: error check with multi-word variables
-----------------------------------
I think it's:
get thingy :*

You might also wonna watch out for Y & N since they appear to be strings be sure to add the "Y".

-----------------------------------
andrew.
Thu Dec 04, 2008 11:25 pm

RE:error check with multi-word variables
-----------------------------------
Zren is right. Just add : * after your get line.

get ans : *

And yeah, you definitely have to change it from saying if ans = Y to if ans = "Y".

-----------------------------------
Tyr_God_Of_War
Thu Dec 04, 2008 11:30 pm

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
Thu Dec 04, 2008 11:45 pm

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.
