##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Your programs need to make decisions. Learn if-else, switch, and how to combine conditions logically.
The Goal
Understanding program paths
Running code conditionally
What goes in parentheses
Test understanding
Choosing between alternatives
When to use if-else
Conditional execution
Test understanding
More than two paths
How conditions are checked
Conditional execution
Why sequence matters
Test understanding
Testing within branches
Choosing the right structure
Conditional execution
Which if owns the else
Test understanding
Testing relationships
Requiring multiple conditions
Multiple conditions
Equality check
Alternative conditions
Testing for false
Test understanding
Choosing from constants
Structure of switch
Multi-way branching
Exiting the switch
Intentional case sharing
Loop exit
Handling unexpected values
Test understanding
Discrete value matching
Avoiding errors
Conditional execution
Converting scores to letters
Four operations
Multiple rules with &&
Solving problems together
Sum and compare
Breaking it down
Knowledge check
Complete solution
summary
Reordering addition
Parse then reorder
Breaking it down
Knowledge check
Complete solution
summary
What we learned