MissingElseTerminates
DRAFT

Misconception:

If the condition in an if-then is false, the blocks following (not inside) the if-then will not execute.

Incorrect

Blocks following an if without else will not execute if the condition is false

Correct

Blocks following an if without else will execute even if the condition is false

Correction
Here 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 the if-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:

true
false
say a
say b
i > 0
say c
say d
say e
say f

The two possible paths are:

  • a, b, c, d, e, f — if i > 0
  • a, b, e, f — if i <= 0

Origin
Where 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)


Symptoms
How 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?

ProMAT P16 Stage

Answers

  1. The cat says “red”
  2. The cat says “red,” then “blue”
  3. The cat says “blue”
  4. The cat says nothing.

The fourth answer could indicate the presence of this misconception.

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.