View Single Post
  #5   Spotlight this post!  
Unread 16-02-2003, 13:52
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 Tazlikesrobots
Thanks for the help. It does not make a whole lot of sence since "&" and "and" are the same thing, however it works now!
They actually aren't AND is the logical version (like C's && if that helps) whereas & is the bitwise version (like C's &). For more detail, see this post.

Taking your previous code, assume sw1=1, sw2=0, sw3=1. Evaluate left to right:

sw1 & sw2 & sw3 => 1 & 0 & 1, which is 0. Then apply the comparison evaluator, 0=0, which evaluates to true. Thus if any of the switches are 0, this will evaluate to true.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php