Programming languages - AQABoolean operations

Proficient programming requires knowledge of many techniques. These techniques allow for powerful, complex programs to be created.

Part ofComputer ScienceComputational thinking and problem solving

Boolean operations

are used to combine relational operators to give more complex decisions.

Boolean operationOperatorExample
AndANDIF x > 0 AND x < 10
OrORIF topic = "Computing" OR topic = "Computer Science"
NotNOTWHILE NOT x
Boolean operationAnd
OperatorAND
ExampleIF x > 0 AND x < 10
Boolean operationOr
OperatorOR
ExampleIF topic = "Computing" OR topic = "Computer Science"
Boolean operationNot
OperatorNOT
ExampleWHILE NOT x

The code below uses two conditions to check if the password entered is both the correct length of six or more characters and is not a number:

password ← USERINPUT
IF LEN(password) >= 6 AND IS_NUMERIC(password) = False THEN OUTPUT “Good Password!”
ELSE OUTPUT “Password too short”
ENDIF