Thread: AND vs. &
View Single Post
  #3   Spotlight this post!  
Unread 01-02-2003, 16:36
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
First, the Basic Stamp manual says specifically not to use &/AND interchangeably. The difference, like Goya said, is that & is bit-based. For example: 1100110 & 0110011=0100010, wherease 1100110 AND 0110011 is not well-defined. Basically, use AND for combining conditions in IF statements (ie IF rc_sw1=1 AND rc_sw2=0 then doStuff), but use & when doing binary math.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php