Skip to content

4.2 Detecting equal values with branches

  • The equality operator (==) evaluates to true if the left and right sides are equal. Ex: If numYears is 50, then numYears == 50 evaluates to true.

Untitled.png

  • An if-else statement executes one group of statements when an expression is true, and another group of statements when the expression is false

Multi-branch if-else statements

Untitled%201.png

Untitled%202.png