CodeIEB
Theory Notes/πŸ—„οΈ Topic 4: Data & Information Management, Solution Development/10.4.4
10.4.4Grade 10

Boolean Logic Basics

The logical foundation for every 'if' statement, search query, and SQL WHERE clause you'll ever write.

A Boolean is a data type that can only ever be true or false β€” it's the odd one out among the simple data types (String, char, int, double) because it doesn't store a value/quantity, only a logical state.

Relational operators β€” compare two values and produce a Boolean result:

OperatorMeaning
>Greater than
>=Greater than or equal to
<Less than
<=Less than or equal to
= / ==Equal to (== in Java for primitive comparison)
!= / <>Not equal to

Logical operators β€” combine multiple Boolean expressions:

OperatorMeaningTrue when…
NOTReverses a Boolean valueThe original value was false
ANDBoth conditions must be trueCondition A is true AND Condition B is true
ORAt least one condition must be trueCondition A is true OR Condition B is true (or both)

Order of operations: NOT is evaluated first, then AND, then OR β€” but always use brackets to make complex conditions explicit and avoid ambiguity.

Truth tables list every possible combination of input values and the resulting output β€” for up to 3 variables at this level, you should be able to construct and read one fully.

Example

Truth table for (A AND B) OR C: A=T, B=T, C=F β†’ (T AND T)=T, T OR F = T A=F, B=T, C=F β†’ (F AND T)=F, F OR F = F A=F, B=F, C=T β†’ (F AND F)=F, F OR T = T

These same Boolean logic principles apply directly to search engines (10.2.6), programming language conditions (10.4.8), and SQL WHERE clauses (10.4.11) β€” master it once, use it everywhere.

πŸ’‘ Exam Tip

Common mistake: forgetting that in code, a compound condition needs each side fully written out β€” e.g. 'age >= 18 AND age <= 65' cannot be shortened to '18 <= age <= 65' the way it can in maths.