Control Flow
The control flow is the path of execution through a program.
Related concepts: SequenceConditionalLoop
Closest Wikipedia entry: Control flow
Misconceptions about Control Flow34 documented Misconceptions
Check YourselfCatchAlwaysExecutes
Catch blocks always get executedCatchProvidesOptions
Only the necessary part of a catch block executesConditionOneOutEdge
A condition node in a control-flow graph can have a single outgoing edgeConditionalIsSequence
If-else is equivalent to sequence of two ifsDeferredReturn
A return statement in the middle of a method doesn't return immediatelyElsIf
There is an elsif keyword for multi-way conditional statementsElseAlwaysExecutes
The else branch of an if-else statement always executesForIsConditional
The body of a for statement executes at most onceIfIsLoop
The body of an if statement executes repeatedly, as long as the condition holdsIfRequiresElse
Every if statement requires an elseInterproceduralEdge
In an intra-procedural control-flow graph, method call nodes point to the called methodLoopTerminatingCondition
For and while loops end when the condition becomes trueNoShortCircuit
&& and || always evaluate both operandsPreIncrementBeforeLoop
Pre-increment in update part of for loop means increment before loop bodyRecursiveMethodNeedsIfElse
A recursive method needs to contain an if-else statementReturnNoOutEdge
In a control-flow graph, a return statement has no outgoing edgeStatementMultipleOutEdges
A non-condition node in a control-flow graph can have multiple outgoing edgesTryCatchMandatory
If code could throw an exception, you must surround that code with a try/catch blockTryFinishes
Exceptions get thrown at the end of the try blockZeroInEdges
A control-flow graph node (other than the entry node) can have zero incoming edgesZeroOutEdges
A control-flow graph node (other than the exit node) can have zero outgoing edges