RE: "if var!=-1 then" and "if not var=-1 then"

new topic     » topic index » view thread      » older message » newer message

> -----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

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu