bogdandaniel Posted September 5, 2003 Posted September 5, 2003 Dim result As Boolean result = result = False What is this? now the result is true!! Quote
Tryster Posted September 5, 2003 Posted September 5, 2003 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... Quote
*Experts* Bucky Posted September 5, 2003 *Experts* Posted September 5, 2003 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; Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.