Control Flow
Your programs need to make decisions. Learn if-else, switch, and how to combine conditions logically.
Lessons
1. Intro
The Goal
2. What is Control Flow?
Understanding program paths
3. The if Statement
Running code conditionally
4. Condition Expressions
What goes in parentheses
5. Quiz: if Basics
Test understanding
6. if-else Statement
Choosing between alternatives
7. Choosing Between Two Options
When to use if-else
8. Quiz: Conditional execution
Conditional execution
9. Quiz: if-else
Test understanding
10. Chained if-else
More than two paths
11. else if Statement
How conditions are checked
12. Quiz: Conditional execution
Conditional execution
13. Order of Conditions
Why sequence matters
14. Quiz: Chained Conditions
Test understanding
15. Nested if Statements
Testing within branches
16. When to Nest vs Chain
Choosing the right structure
17. Quiz: Conditional execution
Conditional execution
18. The Dangling else Problem
Which if owns the else
19. Quiz: Nested if
Test understanding
20. Comparison in Conditions
Testing relationships
21. Combining Conditions with &&
Requiring multiple conditions
22. Challenge: Grade Calculator
Multiple conditions
23. Quiz: Equality check
Equality check
24. Combining Conditions with ||
Alternative conditions
25. Negating Conditions with !
Testing for false
26. Quiz: Logical Operators
Test understanding
27. The switch Statement
Choosing from constants
28. switch Syntax
Structure of switch
29. Quiz: Multi-way branching
Multi-way branching
30. The break Keyword
Exiting the switch
31. Fall-through Behavior
Intentional case sharing
32. Quiz: Loop exit
Loop exit
33. The default Case
Handling unexpected values
34. Quiz: switch Statement
Test understanding
35. switch vs if-else
Discrete value matching
36. Common Condition Mistakes
Avoiding errors
37. Quiz: Conditional execution
Conditional execution
38. Problem - Grade Calculator
Converting scores to letters
39. Problem - Simple Calculator
Four operations
40. Problem - Leap Year
Multiple rules with &&
41. Problem - Team
Solving problems together
42. Team - The Idea
Sum and compare
43. Team - Algorithm
Breaking it down
44. Quiz: Knowledge check
Knowledge check
45. Team - Implementation
Complete solution
46. Lessons from Team
summary
47. Problem - Helpful Maths
Reordering addition
48. Helpful Maths - The Idea
Parse then reorder
49. Helpful Maths - Algorithm
Breaking it down
50. Quiz: Knowledge check
Knowledge check
51. Helpful Maths - Implementation
Complete solution
52. Lessons from Helpful Maths
summary
53. Section Recap
What we learned