View Single Post
  #20   Spotlight this post!  
Unread 27-04-2010, 18:36
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: List of Killer Bee Bot Bottoms

Quote:
Originally Posted by Schnabel View Post
I found an error in your code, let's debug:


In this setting, 33 is your variable (assuming you defined it earlier). Let's assume 33 is currently set to null. In your example above, you are saying "If set 33 to Team then call Win" However Team is not a valid variable, instead it should be 'Team'. So that would kill you first. THEN you are setting 33 to Team, I think you would rather do a Binary test now wouldn't you? You would rather it be "If 33 is Team then call Win" which would require double =. So for this statement to function properly, you should have wrote:
If (33 == 'Team') WIN();
.
.
.
.
.
.
.
.
.
.
.
.
.
.
I disagree. == is not =.
= sets one variable to another. == checks for a comparison. so I am checking that team is equal to 33, if it is, then win. The order does not matter.
Actually, in C (or C++), it is better to put the constant before the variable, in case you forget the second =, so the compiler will give you an error for setting a constant instead of getting some crazy error at runtime.

EDIT: I see that BJC forgot the second =. The actual one says "if (33==team) win();"
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
Reply With Quote