In the first three chapters, programs ran from top to bottom along a single path.
Real-world business problems, however, involve conditions and choices.
Business Rules
- Online orders of 99 yuan or more ship for free; otherwise, a base shipping fee applies.
- When the account balance is sufficient, the deduction succeeds; otherwise, payment fails.
- An exam score of 60 or above passes; otherwise, it fails.
Chapter Roadmap
- Single-branch, two-way, and multi-branch structures.
- Compound conditions, short-circuit evaluation, and independent checks.
- Nested branches and branching inside functions.
Extended topics: conditional expressions and guard clauses.