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 thedofamily 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
whereanddo concurrentbegin. 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
dovariable holds after the loop, the constraints onselect caselabels, whyforallis 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 concurrentand the obsolescence offorall. 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 /
gfortrandocumentation. The "GNU Fortran" manual documentsdo concurrentsupport 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 thegotothat the language'sdo … end doconstructs 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 usedo concurrentversusdo, and whyforallfell out of favor — practitioner reasoning you will not find in a reference manual. Tier 2.
Suggested order
- Read the branching-and-looping chapters of Chapman alongside this one; type and run every example.
- Test your "what does this print?" instincts in the
fortran-lang.orgplayground — instant feedback is the fastest way to lock in loop semantics. - When a rule surprises you (the value of a
dovariable after the loop; whyrealcaselabels are forbidden), look it up in Metcalf, Reid, and Cohen. - Once you have written a few loops of your own, read Dijkstra's letter — it will change how you feel
about every
gotoyou meet in the legacy code of Part IV.