3.5 Compound Boolean Expressions
Enduring Understanding
Programmers incorporate iteration and selection into code as a way of providing instructions for the computer to process each of the many possible input values.
Learning Objective
Represent branching logical processes by using nested conditional statements.
Essential Knowledge
Nested if statements consist of if statements within if statements.
Enduring Understanding
The way variables and operators are sequenced and combined in an expression determines the computed result.
Learning Objective
Evaluate compound Boolean expressions in program code.
Essential Knowledge
Logical operators !(not), &&(and), and ||(or) are used with Boolean values. This represents the order these operators will be evaluated.
An expression involving logical operators evaluates to a Boolean value.
When the result of a logical expression using && or || can be determined by evaluating only the first Boolean operand, the second is not evaluated. This is known as short-circuited evaluation.
Last updated
Was this helpful?