Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program Solution#5
#5
(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.
Reply


Messages In This Thread
Program Solution#5 - by eoredson - 10-21-2025, 12:47 AM
RE: Program Solution#5 - by bplus - 10-21-2025, 01:15 AM
RE: Program Solution#5 - by eoredson - 10-21-2025, 01:34 AM
RE: Program Solution#5 - by SMcNeill - 10-21-2025, 07:13 AM
RE: Program Solution#5 - by bplus - 10-21-2025, 01:41 AM
RE: Program Solution#5 - by bplus - 10-21-2025, 07:59 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Program Solution#4 eoredson 0 465 06-18-2025, 03:32 AM
Last Post: eoredson
  Program Solution#3 eoredson 1 493 06-17-2025, 04:16 AM
Last Post: SierraKen
  Program Solution#2 eoredson 0 430 06-16-2025, 04:19 AM
Last Post: eoredson
  Program Solution#1 eoredson 0 418 06-16-2025, 04:17 AM
Last Post: eoredson

Forum Jump:


Users browsing this thread: 1 Guest(s)