ListsHomogeneousDRAFTNot Observed
One cannot add items of different types, such as strings and numbers, to the same list.
All items in a list must have the same type
A list can contain items of different types
CorrectionHere is what's right.
In Scratch, lists can be heterogeneous: a list can contain a mix of strings and numbers.
The following code is perfectly fine:
It adds the number 10 and the string “blue” to the list my favorites
.
OriginWhere could this misconception come from?
ValueHow can you build on this misconception?
This can be an opportunity to introduce the concept of types, and that there are several types of values in Scratch.
Numbers and Strings
The most prominent types are the numbers and the strings. Blocks that produce values of type number or of type string are round:
Holes that expect values of type number or of type string are round, too:
Booleans
There also are values of type boolean;
however Scratch treats booleans slightly differently.
It does not support literals of type boolean (true
and false
).
And blocks that produce boolean values have a different shape:
Holes that expect values of a boolean type also have that shape: