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
0 Response to "The combination of True and False "
Post a Comment