hts.StevenWood.com

Boolean Logic

Home ] Up ] Karel 15 ] Karel 15a ] Karel 15b ] Karel 15c ] Karel 15d ] [ Boolean Logic ] CheckList ] Rubric ][ Last Page ]

Examples with Robots

 

 

Truth Tables for the Boolean Operators:
AND, OR, and NOT

 

The opposite of the condition must be true.
e.g. if A is true then the condition is false

Use ! to represent the words "the opposite"

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.

Home ] Up ] Karel 15 ] Karel 15a ] Karel 15b ] Karel 15c ] Karel 15d ] [ Boolean Logic ] CheckList ] Rubric ][Last Page]
All material on this site is copyright © 1997- by Steven Wood or as credited. All right reserved. Use of this site indicates you agreement with the  terms of use.
Send comments or questions to about this page.
Every attempt has been made to credit work under copyright. If there are any claims that copyright has been missed please contact the .
+SDG+