Represent execution paths through a method or function as a graph
Control Flow as Graph

This notional machine represents method bodies as graphs. Statements are represented as rectangles and conditions as diamonds.
This makes the possible execution paths through the different statements of a method visible and is particularly useful for explaining compound statements (loops and conditional statements), conditional expressions, and exception handling.
24 Misconceptions Expressible in this Notional Machine
A notional machine focuses on a subset of the syntax and semantics of a programming language. The following misconceptions are related to the language features expressible in this notional machine.
CatchAlwaysExecutes
Catch blocks always get executed
CatchProvidesOptions
Only the part of a catch block necessary to fix the cause of an exception is executed
ConditionalIsSequence
If-else is equivalent to sequence of two ifs
DeferredReturn
A return statement in the middle of a method doesn't return immediately
ElsIf
There is an elsif keyword for multi-way conditional statements
ElseAlwaysExecutes
The else branch of an if-else statement always executes
ForIsConditional
The body of a for statement executes at most once
IfIsLoop
The body of an if statement executes repeatedly, as long as the condition holds
IfRequiresElse
Every if statement requires an else
LoopTerminatingCondition
For and while loops end when the condition becomes true
NoShortCircuit
&& and || always evaluate both operands
PreIncrementBeforeLoop
Pre-increment in update part of for loop means increment before loop body
RecursiveCallSiteNoReturn
Tail-recursive call sites of non-void methods need no return statement
RecursiveMethodNeedsIfElse
A recursive method needs to contain an if-else statement
SuperNotFirstStatement
super() can be called anywhere in the constructor of a subclass
TryFinishes
Exceptions get thrown at the end of the try block
DeferredReturn
A return statement in the middle of a function doesn't return immediately
IfIsLoop
The body of an if-statement executes repeatedly, as long as the condition holds
NoShortCircuit
and/or always evaluate both operands
ConditionalIsSequence
If-then-else block is equivalent to sequence of two if-then blocks
ElseAlwaysExecutes
The else branch of an if-then-else block always executes
MissingElseTerminates
Blocks following an if without else will not execute if the condition is false
RepeatDistributes
Each block in a loop is repeated individually
ResetStateEachLoopIteration
The computation of all loop iterations starts from the state before the loop