• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 13. Using Operators > Troubleshooting

Troubleshooting

The operands are not equal, so why do they test equal?

One of the most common mistakes in ActionScript is using the assignment operator (=) when you should use the equality operator (==). The assignment operator sets a variable, array element, or object property equal to a value. The equality operator tests whether two expressions are equal. Your familiarity with standard arithmetic notation works against you here. Too often, you write if (x = 10), a statement that the ActionScript interpreter sees as always true, when you mean if (x == 10), a statement that is true only when x equals 10.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint