True or False

You are assigning the return value of the expression "result = False" to the variable result...

When you declare the variable result, it is set to False by default. As such the expression "result = False" evaluates to True...
 
Tryster's correct, the = operator is being used two different ways. The
first way, it's used as an assignment operator, assigning the
value of an expression to the variable. The seond time it's a
comparison operator, comparing the value of result (which is False
by default) to False, and because they are equal it returns True.

Maybe this is clearer:
Visual Basic:
result = (result = False)

It's much easier to see a C-style language, beause its equality
comparison operator is ==
C#:
result = result == false;
 
Back
Top