ExpressionAssigns
DRAFT
Not Observed

Misconception:

Using a () variable in an operator block, such as in (score + 1) also updates the value of the variable (score in this case) at the end of the evaluation.

Incorrect

An expression that reads a variable also updates its value after the evaluation

Correct

A variable is only written using an assignment

Correction
Here is what's right.

Students might mistakenly believe that using a variable block

inside an operator block

also updates the value of the variable (score in this case).

For example, they might believe that the following code causes the sprite to say 4, then 14, and then 14 again:

This is wrong. The above code makes the sprite say 4, 14, and 4.

To mutate a variable, one needs to use the set () to () block

or the change () by () block

Origin
Where could this misconception come from?

NOTE — We are not aware of repeated observations of this misconception in Scratch. We documented it, for completeness, based on observations of an equivalent misconception in other languages.

Value
How can you build on this misconception?

This is an opportunity to discuss the concept of expressions.

In Scratch, we can compose expressions from numbers and strings and operator blocks.

We can directly type numbers or strings into holes. Numbers and strings are what is known as literals in other programming languages. They are the simplest kind of expressions.

We can also plug operator blocks into holes. There are two kinds of operator blocks: reporter blocks (that produce numbers or strings) and boolean blocks (that produce truth values). Operator blocks are known as operators in other languages. Here is an example of an operator block:

We can create an expression by filling in the holes of the operator block.

We can compose arbitrarily complex expressions in this way:

Any expression, when executed, produces a value. We say it gets “evaluated”.

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.