View Single Post
  #7   Spotlight this post!  
Unread 17-02-2003, 01:47
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Quote:
Originally posted by Justin Stiltner
umm... im using &, and ~= and their working just fine in my code...
and they are used in the default code from I.F.
~= is not valid syntax. The editor complains about it and won't even tokenize. It also is not any of the four default codes, so I'm not sure where you saw it. As for &, it is not the correct operator to use here. Here's a quote straight from the Stamp Manual (page 153):
Quote:
The easiest way to avoid the kinds of problems this might cause is to always use a conditional operator with IF...THEN. Change the example above to read IF Flag = 1 THEN IsTrue. The result of the comparison will follow IF...THEN rules. Also, the logical operators will work as they should; IF NOT Flag = 1 THEN IsTrue will correctly evaluate to false when Flag contains 1.
This also means that you should only use the "named" conditional logic operators NOT, AND, OR, and XOR with IF...THEN. The conditional logic operators format their results correctly for IF...THEN instructions. The other logical operators, represented by symbols ~ & | and ^ do not; they are binary logic operators.
Finally, see any of the below threads for more info:

http://www.chiefdelphi.com/forums/sh...threadid=18007
http://www.chiefdelphi.com/forums/sh...hlight=bitwise
http://www.chiefdelphi.com/forums/sh...hlight=bitwise
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php