Affiliate disclosure

Book titles on this page link to Amazon. As an Amazon Associate, DataField.Dev earns from qualifying purchases — at no additional cost to you.

Further Reading: Control Flow

Control flow is standard across languages, so the goal here is not to relearn if and while but to see Fortran's constructs precisely and to understand why modern code prefers them. Sources are tagged Tier 1 (canonical, recommended) and Tier 2 (real and worth seeking; confirm the current edition or URL yourself).

The teaching texts

  • Stephen Chapman, Fortran for Scientists and Engineers (McGraw-Hill). Its chapters on branching and looping cover if, select case, and the do family with many worked examples in a scientific-computing spirit close to ours — the natural companion read for this chapter. Tier 1.
  • Milan Curcic, Modern Fortran: Building Efficient Parallel Applications (Manning). Project-driven and modern; good for seeing control flow used inside real numerical code rather than in isolation, and strong on the array-and-parallel mindset that where and do concurrent begin. Tier 1.

The precise rules

  • Metcalf, Reid, and Cohen, Modern Fortran Explained (Oxford University Press). The definitive language reference. When you need the exact semantics — the trip-count rule, what a do variable holds after the loop, the constraints on select case labels, why forall is obsolescent — this is where the standard is explained in readable prose. Tier 1.
  • The ISO/IEC 1539-1:2018 Fortran standard. The final authority on every construct in this chapter, including the exact status of do concurrent and the obsolescence of forall. Dense, but the place to settle an argument. Tier 1.

Free and online

  • fortran-lang.org — Learn. The community tutorials include clear, runnable introductions to branching and loops; the in-browser playground lets you test a "what does this print?" prediction in seconds without installing anything. Tier 1.
  • The GCC / gfortran documentation. The "GNU Fortran" manual documents do concurrent support and the warning flags (-Wall, -Wsurprising, -fcheck=all) that catch control-flow mistakes such as an out-of-bounds index or a suspicious loop. Tier 1.

On the history and the "why"

  • Edsger W. Dijkstra, "Go To Statement Considered Harmful," Communications of the ACM 11(3), 1968. The letter that launched structured programming and this chapter's epigraph. Reading it explains why modern Fortran gives you exit, cycle, and named loops instead of the goto that the language's do … end do constructs were designed to replace. Short, sharp, and historically decisive. Tier 1.
  • The Fortran Discourse (fortran-lang.discourse.group). Search it for real discussions of when to use do concurrent versus do, and why forall fell out of favor — practitioner reasoning you will not find in a reference manual. Tier 2.

Suggested order

  1. Read the branching-and-looping chapters of Chapman alongside this one; type and run every example.
  2. Test your "what does this print?" instincts in the fortran-lang.org playground — instant feedback is the fastest way to lock in loop semantics.
  3. When a rule surprises you (the value of a do variable after the loop; why real case labels are forbidden), look it up in Metcalf, Reid, and Cohen.
  4. Once you have written a few loops of your own, read Dijkstra's letter — it will change how you feel about every goto you meet in the legacy code of Part IV.