(10-21-2025, 01:34 AM)eoredson Wrote: Since when does:
Code: (Select All)
f$ = "10" g$ = "1"
f$ = "10" g$ = "10" Both equal.
f$ = "10" g$ = "100" Both equal.
f$ = "10" g$ = "1000"
f$ = "10" g$ = "10000"
f$ = "10" g$ = "100000" Both equal.
f$ = "10" g$ = "1000000" Both equal.
f$ = "10" g$ = "10000000"
f$ = "10" g$ = "100000000"
f$ = "10" g$ = "1000000000" Both equal.
N paradox here. The results are exactly what you programed for.
Code: (Select All)
If Len(f$) And Len(g$) Then
2 AND 1 = 0
2 AND 2 = 2
2 AND 3 = 2
2 AND 4 = 0
2 AND 5 = 0
2 AND 6 = 2
2 AND 7 = 2
2 AND 8 = 0
2 AND 9 = 0
2 AND 10 = 2
AND is used for binary comparison of values. It compares bits. Let's look at 2 AND 3, for example:
00000010 <--- binary for 2
00000011 <--- binary for 3
------------ <-- LET'S AND THEM!!!
00000010 <--- If the bits are both on, keep them if either is off, the result is off.
So 2 AND 3 is 2.
And since 2 is a non-zero value, and zero is the only number we count as FALSE, the result is TRUE.
X AND Y is no where near the same code as X = Y. There's no paradox here. Just bad coding at work, and poor understanding of commands, at work -- which is more or less just part of programming.