Product SiteDocumentation Site

11.3.8.2.2. Assignment/Equality Mistake
Beware the following pitfall, common to a large number of programming languages:
a == 42; // evaluates to "true" or "false", depending on the value in "a"
a = 42; // assigns the value 42 to "a", over-writing the previously-stored value
One possible work-around is to write the number first.
42 == a; // evaluates to "true" or "false", depending on the value in "a"
42 = a; // causes an error, because you can't assign a value to a constant number
This way, if you accidentally leave out one of the = signs, the interpreter will stop execution and produce an error, rather than continuing with an unexpected assignment.