Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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...

  • *Experts*
Posted

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:

result = (result = False)

 

It's much easier to see a C-style language, beause its equality

comparison operator is ==

result = result == false;

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...