Topic 4: Making Decisions Flashcards
Represents only one of two states
Boolean expression
Expression evaluates to either true or false
Boolean expression
To express Boolean tests when comparing values
Relational comparison operators
(Using relational operators) Rule of thumb: Ask the question most likely to have a __________ outcome first
positive
(Using relational operators) Rule of thumb: Avoid “_________” when it results in a double negative
not equal
Requires that both of two tests evaluate to True
AND decision
Requires a nested decision (nested if)
AND decision
(Nested AND Decisions) Rule of Thumb: First ask the question that is _____ likely to be true
less
Allows you to ask two or more questions (Boolean expressions) in a single comparison
Logical AND operator
(OR decisions) Rule of Thumb: First ask the question that is ______ likely to be true
more
Only one Boolean expression must be true to produce a result of true
Logical OR operator
Compare a variable to a series of values between limits
Range check
Should end points of the range include <= or >= ?
Yes; don’t use < or >
When AND and OR operators are combined in the same statement, _____ operators are evaluated first
AND
Can avoid mixing AND and OR decisions by nesting ____ statements
if