|
|
Examples with Robots
Truth
Tables for the Boolean Operators:
|
|
Input A |
Output !A |
|
FALSE |
TRUE |
|
TRUE |
FALSE |
If both
conditions must be true.
e.g. A and B must be true for the condition to be true.
Use && to represent the word "AND"
|
Input A |
Input B |
Result A && B |
|
FALSE |
FALSE |
FALSE |
|
FALSE |
TRUE |
FALSE |
|
TRUE |
FALSE |
FALSE |
|
TRUE |
TRUE |
TRUE |
If only one
condition must be true.
e.g. A or B must be true for the condition to be true.
Use || to represent the word "OR"
|
Input A |
Input B |
Result A || B |
|
FALSE |
FALSE |
FALSE |
|
FALSE |
TRUE |
TRUE |
|
TRUE |
FALSE |
TRUE |
|
TRUE |
TRUE |
TRUE |
Source: Roy Paterno. Association of Computer Science Educators. Grade 11 Resources - Draft Version. http://www.acse.net/Grade11/ICS3U.doc. August 10, 2001. Adapted.
| ||||