Not Yet Observed
EqualityOperatorComparesOnlyTypes
Incorrect
() = () compares only the types of its operands
Correct
() = () compares the values of its operands
CorrectionHere is what's right.
Here is what's right.
The () = ()
operator compares the values of its operands.
While the following block, with operands of different types
(the first a string, the second a number)
evaluate to false
the following block also evaluates to false
;
the two operands have the same type, they are numbers,
but they have different values:
OriginWhere could this misconception come from?
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.
In JavaScript there are different equality operators (==
and ===
),
and the difference in their semantics
has something to do with the types of their operands.
Language
Scratch