Expanded Conditions•The condition of an if statement can contain the Boolean operators–And&&–Or||–Not!24002-208
Truth Table for And OperatorGiven a condition b1 && b2 where b1 and b2 have a Boolean value, the result of the And operator is shown in the following tableb1b2b1 && b2FalseFalseFalseFalseTrueFalseTrueFalseFalseTrueTrueTrue34002-208
This preview has intentionally blurred sections.
Sign up to view the full version.
Example of And Operator•Test to see if x is between 1 and 22, inclusivelyif ( x >= 1 && x <= 22)The relation condition x >= 1 is evaluated (T or F) and then x <= 22 is evaluated (T or F). The And operator is applied.•Test to see if t is between 4 and 12, exclusivelyif ( t > 4 && t < 12)44002-208