Conditional
In a conditional statement or expression the value of a condition determines which alternative pieces of code to execute.
Related concepts: StatementExpressionControl Flow
Closest Wikipedia entry: Conditional (computer programming)
Misconceptions about Conditional21 documented Misconceptions
Check YourselfBaseCaseNotNeeded — Java
Recursive computations do not necessarily need a base case
ConditionalIsSequence — Java
If-else is equivalent to sequence of two ifs
ElsIf — Java
There is an elsif keyword for multi-way conditional statements
ElseAlwaysExecutes — Java
The else branch of an if-else statement always executes
ForIsConditional — Java
The body of a for statement executes at most once
IfIsLoop — Java
The body of an if statement executes repeatedly, as long as the condition holds
IfRequiresElse — Java
Every if statement requires an else
LoopTerminatingCondition — Java
For and while loops end when the condition becomes true
MapToBooleanWithConditionalOperator — Java
To map a boolean expression to a boolean, a conditional operator is necessary
MapToBooleanWithIf — Java
To map a boolean expression to a boolean, an if statement is necessary
RecursiveMethodNeedsIfElse — Java
A recursive method needs to contain an if-else statement
ConditionalOperatorNotExpression — JavaScript
The conditional operator is not an expression
ConditionalIsSequence — Python
If-else is equivalent to sequence of two ifs
IfIsLoop — Python
The body of an if-statement executes repeatedly, as long as the condition holds
MapToBooleanWithIf — Python
To map a boolean expression to a bool, an if statement is necessary
MapToBooleanWithTernaryOperator — Python
To map a boolean expression to a bool, a ternary conditional operator is necessary
RecursiveFunctionNeedsIfElse — Python
A recursive function needs to contain an if-else statement
BaseCaseNotNeeded — Scratch
Recursive computations do not necessarily need a base case
ConditionalIsSequence — Scratch
If-then-else block is equivalent to sequence of two if-then blocks
ElseAlwaysExecutes — Scratch
The else branch of an if-then-else block always executes
MissingElseTerminates — Scratch
Blocks following an if without else will not execute if the condition is false