1. How come the first msgbox returns false and the second msgbox returns true?>

Code:
```  MsgBox 5 = 5 = 5
MsgBox 5 = 5```  Reply With Quote

2. I don't know for sure but I think it has to do with the fact that VB doesn't understand your zomparison.

I have been trying a couple of things and it's with all the lines where there more then one "=" symbol. There where there was one, it worked.

It's just a guess, but I could be right?:Confused:  Reply With Quote

3. I don't know for sure but I think it has to do with the fact that VB doesn't understand your zomparison.

I have been trying a couple of things and it's with all the lines where there more then one "=" symbol. There where there was one, it worked.

It's just a guess, but I could be right?  Reply With Quote

4. maybe it has something to do with this:
5 = 5 is true
so
5 = 5 =5
is like saying:
True = 5
I don't know, maybe.  Reply With Quote

5. I think it only does simple equations? Like there are only 2 parts to an equation side1 and side2   Reply With Quote

6. The reason why the second returns true is because

5=5 -----> True

msgbox 5=5 ---------> true

The reason why the first returns false is because it goes from left to right.

First it compare the first two.

5=5 -----> True

Next, it takes the result of that and compare to the rest.

True=5---> False

msgbox 5=5=5 ---------> false

if you have done it like

msgbox 5=5=true ---------> True
msgbox true=5=5 ---------> False  Reply With Quote

7. ## Hey, cool I was right!

Yeah for me!  Reply With Quote

8. Wait a sec. Nonzero values are evaluated as True.

True = (True = 5)

According to vb's rules of boolean logic, ((5=5)=5) should return True.

when you convert True to in integer you get -1; false you get 0.

a = 5
If a Then
Beep
End if

The system would beep. VB violates it's on boolean logic rules. No problem, since I would just use the keyword True or False instead of an expression that ALWAYS returns true or false.

\$0.02  Reply With Quote

9. Wow agent ... you have been "burning up" the internet.

hehe. I know (bad joke). I hope that your house fire wasn't a great loss.

Cordially,
Flint  Reply With Quote

10. OK, heres the solution

VB's "favorite" definition of True (numerically) is -1

so

msgbox -1 = -1 = -1 'returns "True"

because -1 does equal -1
thus
-1 = true

This definition only seems to apply to explicit constants (if you actually hard code the numbers into a comparison) but things like

len("xyz") 'will return an expression that can be used in a boolean situation.  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•