MissingElseTerminates
If the condition in an if-then
is false, the blocks following (not inside) the if-then
will not execute.
Blocks following an if without else will not execute if the condition is false
Blocks following an if without else will execute even if the condition is false
CorrectionHere is what's right.
There are two possible path execution can take through an if-then
block:
- If the condition evaluates to true,
the blocks nested in the
if-then
block are executed, and then execution continues with the blocks following theif-then
block. - If the condition evaluates to false,
the execution directly continues with the blocks following the
if-then
block.
Control-Flow Graph
The meaning of control-flow blocks like the if-then
block
can be explained in a visual way with a control-flow graph:
The control-flow graph of the above code looks as follows:
The two possible paths are:
- a, b, c, d, e, f — if
i > 0
- a, b, e, f — if
i <= 0
OriginWhere could this misconception come from?
Overfitting
Learners may only be exposed to examples
where the if-then
block is at the end of the script,
such as this:
If they do not see any blocks after a conditional while learning, they do not form a mental model about the meaning of such a sitatuation.
Text Documents
The if-then
block may look like a section header in a text,
where everything following it is considered part of the section.
Here is an example, where one would consider Section 1 to include all the text between the “Section 1 Header” and “Section 2 Header”.
…
Section 1 Header (if-then
block)
- Text (block nested in
if-then
block) - Text (block nested in
if-then
block)
Text (block following if-then
block)
Text (block following if-then
block)
Section 2 Header (if-then
block)
…
SymptomsHow do you know your students might have this misconception?
Empirical Evidence
This misconception appears in Item P16 in the Scratch ProMAT assessment:
Question
Milena has written a small program for the cat.
She wants to test where the cat is at the moment. What happens here when she clicks the green flag?
Answers
- The cat says “red”
- The cat says “red,” then “blue”
- The cat says “blue”
- The cat says nothing.
The fourth answer could indicate the presence of this misconception.
Language
Concepts
Expressible In
Literature References
Quantitative systematic research
57 grade 5 or 6 students
Qualitative study (interviews)
56 high school students showing significant difficulties in a screening test
Qualitative study (interviews)
35 high-school students showing significant difficulties in a screening test