LiteralNoExpressionDRAFT
A literal is not an expression
Even an individual literal is an expression
CorrectionHere is what's right.
A literal is the most basic form of expression. When looking at an expression as a tree, a literal is a leaf in such a tree.
Like every expression, a literal has a value. The value of 42
is 42.
Like every expression, a literal also has a type. The type of 1234567
is int
.
Understanding that a literal is an expression allows students to reason about expressions in a general, compositional way. Any rules they learn about expressions apply to literals, because literals are expressions.
OriginWhere could this misconception come from?
Scratch does not use blocks to represent literal values; instead students directly enter literals into the holes of the surrounding blocks.
The following example shows a green block for an addition, with two holes for two subexpressions:
To compute score + 10
,
the student will plug a block for the score
variable into the left hole,
but there is no block for the literal 10
.
Instead, the student directly types the literal value 10
into the right hole.
This may provide students with the impression that literals are not expressions.
Language
Concepts
Expressible In
Related Misconceptions
Literature References
The following papers directly or indirectly provide qualitative or quantitative evidence related to this misconception.