Section2.13Unit 2 Part 1 Summary on Selection (2.1-2.6)
In the first half of this unit, lessons 2.1 - 2.6, you learned about conditionals. Conditionals are used to execute code when a boolean expression is true or false. A boolean expression is one that is either true or false like x > 0.
short circuit evaluation - The type of evaluation used for logical and (&&) and logical or (||) expressions. If the first condition is false in a compound boolean expression joined with a logical and, then the second condition wonβt be evaluated. If the first condition is true in a compound boolean expression joined with a logical or then the second condition wonβt be evaluate.
if (Boolean expression) - used to start a conditional statement. This is followed by a statement or a block of statements that will be executed if the Boolean expression is true.
else if (Boolean expression) - used to have 3 or more possible outcomes such as if x is equal, x is greater than, or x is less than some value. It will only execute if the condition in the βifβ was false and the condition in the else if is true.
Putting a ; at the end of if (test);. Remember that the if statement ends after if (test) statement; Or better yet, always use curly braces if (test) { statements;
}.
Not understanding short circuit evaluation which is that if evaluation of the first Boolean expression is enough to determine the truth of a complex conditional the second expression will not be evaluated.