Unit 3 · 3 lessons
If Statements
Boolean logic, if / else if / else, the switch statement, and how to validate input so a program does not fall over.
- 34 practice questions
- 29 flashcards
Lessons
- 1Boolean Expressions and ComparisonEvery decision a program makes reduces to one true-or-false value. Here is how those values are built, combined, and the two Java traps that quietly break them.11 questions
- 2if, else if and elseChoosing a path through a program — the syntax, why braces are never optional in practice, why the order of an else if chain decides the answer, and the ternary shortcut.11 questions
- 3switch, Validation and Choosing a StructureThe switch statement and its fall-through behaviour, when it beats an else if chain, and how to validate input so bad data never reaches your calculation.12 questions