RE: "if var!=-1 then" and "if not var=-1 then"
- Posted by "Derek Parnell" <ddparnell at bigpond.com> Feb 24, 2004
- 511 views
> -----Original Message----- > From: CoJaBo [mailto:cojabo at suscom.net] > Subject: "if var!=-1 then" and "if not var=-1 then" > > > > It there a differance between > if var!=-1 then > and > if not var=-1 then? > > On a program I was working on here is what happened: > > ?st--displayed 5 > if not st=-1 then > puts(1,"Hello!")--didn't run > --bunch of other stuff was here, didn't run > end if Try this instead... if not (st=-1) then puts(1,"Hello!") end if What is happening with your code is equivalent to this ... if (not st)=-1 then puts(1,"Hello!") end if Thus if st is 5, then (not st) is 0, thus it is like saying 'if 0 = -1 then ..." -- Derek