Developing Web Applications

Previous Topic Next Topic

Misusing the Equal Sign

Visual Basic users expect the single “=” (equal sign) to evaluate the equality of the two operands. In JScript, however, the single “=” will assign the right-hand value to the left-hand operand. (JScript uses a double “=” to express equality.) Mistakenly using a single “=” in an expression will not only overwrite the left-hand value, it will cause the expression to evaluate to TRUE. If this happens in an If statement, the inner logic is executed; in a While statement, it creates an infinite loop.


© 1997-1999 Microsoft Corporation. All rights reserved.