Answer to Question #45862 in Action Script | Flash | Flex | ColdFusion for Jonathan Bare

Question #45862
TASK C2.2: Explain why we wrote '==' rather than '=' in the expression.
// Make sure you explain what would happen if you write '=' rather
// than '==' in the expression



return (stack.top == BOTTOMOFSTACK ? true : false);
1
Expert's answer
2014-09-11T06:35:23-0400
Dear visitor,
The '==' is the equality comparison operator. It returns true if the operands are equal.
The '=' is an assignment operator. It returns true if the right operand value is successfully assigned to the left one.
If we have put an assignment operator, it would most likely return true(as assignment was successful), unless the operands are incompatible.
We, on the other hand, want to compare the operands. So the '=' operator is useless to us in this case.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS