Re: True/False statements with OBJECT variables
- Posted by MAP <ddhinc at ALA.NET> Apr 24, 1998
- 648 views
ST Qu Man wrote: > > If I do something like > > object a,b > a="abcdefghijklmnopqrstuvwxyz" > b=gets(0) > If b=a then* > puts(1,"YAY! CORRECT!") > else > puts(1,"BAD!") > end if > > *I get a message at this part of the program and it says (If b != a): > sequences arent equal in length (6 (6 chars) != 26 (26 chars)) . . . > How do I fix that???? PLEASE HELP ME. > Trivia Program Makers Are Very Ineffective If You Can't Compare String > Variables. > > Thanks, > St Qu Man use this instead: if not compare(a,b) then puts(1,"YAY! CORRECT!") else puts(1,"BAD!") end if compare() returns zero for objects that "are" equal to one another, hence the need for the "not" in the comparison. Hope this helps, Christopher D. Hickman