← Skill tree CS Skill Tree 0 CSCD210

Choosing if, else, switch, for, while, and for-each

Textbook: BJP (Reges and Stepp)

Where you are: Week 0 review > Control flow and iteration

This part of the review is three short lessons. Work them in order:

  1. Conditionals: if, else, and switch: choosing exactly one branch, and when switch fits.
  2. Loops: for, while, and do-while: which loop shape fits which task, and how an accumulator carries a result.
  3. The enhanced for (for-each) and its limits: reading every element, and when a traditional for is needed instead.

Finish all three before moving on to methods.


Resources

Canonical: BJP (Reges and Stepp) Ch 4-5 (conditional execution, loops); Liang 10e §3 (Selections), §5 (Loops). Section numbers are grounded from the published tables of contents; exact page numbers depend on the printing and are pending a faculty spot-check.

Show 2 more resources
  • Practice: code.jdoner.me CSCD 210 control flow and loops exercises (coding practice and tracing).
  • Video (URL pending verification): BroCode, Java if statements and loops.