Comparing strings

The idea is that the user types in the word that they are prompted for. In this simple code the word is"two".
I don't get the result I was hoping for. If I type in "two", I expected to get Correct as the response. I get Wrong instead.
Thanks in advance.
CON
  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000
OBJ
  pst:"Parallax Serial Terminal"
var
  byte value[100]
PUB Main
pst.Start(115_200)   
waitcnt (clkfreq *2 + cnt)
 repeat
   pst.Clear
   pst.str(string("Type in the word two.") )    
   pst.Chars(pst#NL,1)
   pst.StrIn(@value)
   pst.Chars(pst#NL,1)
   if @value <> @a2  
     pst.str(string(" Wrong") )
   if @value == @a2       
     pst.str(string(" Correct") )     
   pst.Chars(pst#NL,1)
   waitcnt (clkfreq *2 +cnt)   
DAT
a2 byte "two",0

Comments

Sign In or Register to comment.