Control Flow

The control flow is the path of execution through a program.

Related concepts:  SequenceConditionalLoop

Closest Wikipedia entry:  Control flow

Misconceptions about Control Flow
28 documented Misconceptions

Check Yourself
Misconception
CatchAlwaysExecutes — Java
Catch blocks always get executed
Misconception
CatchProvidesOptions — Java
Only the part of a catch block necessary to fix the cause of an exception is executed
Misconception
ConditionalIsSequence — Java
If-else is equivalent to sequence of two ifs
Misconception
DeferredReturn — Java
A return statement in the middle of a method doesn't return immediately
Misconception
ElsIf — Java
There is an elsif keyword for multi-way conditional statements
Misconception
ElseAlwaysExecutes — Java
The else branch of an if-else statement always executes
Misconception
ForIsConditional — Java
The body of a for statement executes at most once
Misconception
IfIsLoop — Java
The body of an if statement executes repeatedly, as long as the condition holds
Misconception
IfRequiresElse — Java
Every if statement requires an else
Misconception
LoopTerminatingCondition — Java
For and while loops end when the condition becomes true
Misconception
NoShortCircuit — Java
&& and || always evaluate both operands
Misconception
PreIncrementBeforeLoop — Java
Pre-increment in update part of for loop means increment before loop body
Misconception
RecursiveMethodNeedsIfElse — Java
A recursive method needs to contain an if-else statement
Misconception
TryCatchMandatory — Java
When a piece of code can throw an exception, it must be surrounded with a try/catch block
Misconception
TryFinishes — Java
Exceptions get thrown at the end of the try block
Misconception
ConditionalOperatorNotExpression — JavaScript
The conditional operator is not an expression
Misconception
ConditionalIsSequence — Python
If-else is equivalent to sequence of two ifs
Misconception
DeferredReturn — Python
A return statement in the middle of a function doesn't return immediately
Misconception
IfIsLoop — Python
The body of an if-statement executes repeatedly, as long as the condition holds
Misconception
NoShortCircuit — Python
and/or always evaluate both operands
Misconception
OutsideInFunctionNesting — Python
Nested function calls are invoked outside in
Misconception
RecursiveFunctionNeedsIfElse — Python
A recursive function needs to contain an if-else statement
Misconception
RightToLeftChaining — Python
Chained accesses are invoked from right to left
Misconception
ConditionalIsSequence — Scratch
If-then-else block is equivalent to sequence of two if-then blocks
Misconception
ElseAlwaysExecutes — Scratch
The else branch of an if-then-else block always executes
Misconception
MissingElseTerminates — Scratch
Blocks following an if without else will not execute if the condition is false
Misconception
RepeatDistributes — Scratch
Each block in a loop is repeated individually
Misconception
ResetStateEachLoopIteration — Scratch
The computation of all loop iterations starts from the state before the loop