View Single Post
  #3   Spotlight this post!  
Unread 15-02-2004, 07:31
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Boolean statement

Just to clarify what he said, in C any non-zero value is true. Zero is false. So, if you had a variable and you wanted to test if it was zero, you could say:
Code:
    if(!variableBeingTested)
    {
    	// Variable is zero
    }
    else
    {
    	// Variable is not zero
    }
It is considered better form by most people, however to explicitly put in the test for zero. For example:
Code:
     if(variableBeingTested == 0)
     {
     	// Variable is zero
     }
     else
     {
     	// Variable is not zero
     }
--EDIT--
PS I just looked at the last post guy's name and team number and realized he's one of my team's mentors.
__________________


Last edited by Ryan M. : 15-02-2004 at 07:37.