The combination of True and False

 True or False Sometimes the condition can consist of several conditions. For example, we want to determine timeDelay numbers as a positive number not more than 10. So we can not just use one condition. We must use the two conditions, namely timeDelay must be greater than 0 AND timeDelay smaller than 10. In logic, we can write the following manner:

if( (timeDelay > 0) && (timeDelay < 10) ){     
// 
}

Note there is no sign && means AND. Extra parentheses to clarify that there are two different conditions and connected by && operator. Please note again that the logical AND operator will yield a value of True if all the conditions is True. In addition to operators AND, there are also operators OR and NOT. Consider the following table:

Operator           Example    Meaning
&&(A < 10) && (B >10) AND logic will generate True if the conditions
A and B correspond (True),
if not, then False
||(A < 10) && (B >10) OR logic will generate True if one of A, B,
or all of the appropriate (True), but if both are False,
then it would be worth False
!! (A < 10)Logic will NOT generate True if the conditions are
not met (false), because it is NOT the
opposite condition.

  If you are still confused with NOT, then consider the following code:

int status = HIGH;  
int led = !status;    // meaning, led high NO (LOW) 

If status = HIGH or True, then! Status = LOW (HIGH not) or False (not True). Usage is also frequently used, so please be remembered

Subscribe to receive free email updates:

0 Response to "The combination of True and False "

Post a Comment