Boolean expressions and if statnts
If statements
will only run and execute when a certain condition is true; and will ignore the code if the statement isn’t true
one-way selection
Flow of control
The order in which different lines of code will run
Typically each line of code runs from top to bottom
If statements can change the sequence
Two-way selection
if -else statement, meaning there are 2 watts that the code could run, the if or the else
Multi-way selection
If-else-if statement, which only runs one of the man y different listed conditions
Boolean expression
logical operations that check for multiple conditions at once
combines 2 separate Boolean expressions into a single compound Boolean expression
statement or condition that evaluates to true of false
Truth table
used to look at all possible values of the variables, and determine the value of the whole statement
Short-circuit evaluation
When the result of a logical expression using && or || can be determined by evaluating only the first Boolean expression, the second is not evaluated
Morgan’s first Law
If both A and B are true, them the whole expression is true
Morgan’s second Law
If some part of a || statement is true, then the whole expression is true