Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program Solution#5
#1
Interesting Note:

Code: (Select All)

Rem OOPS here:
f$ = "10": g$ = "1"
If Len(f$) And Len(g$) Then
  Print "Both equal."
End If

Rem OK here:
f$ = "10": g$ = "1"
If f$ <> "" And g$ <> "" Then
  Print "Both equal."
End If
Reply
#2
Paradox #5
Code: (Select All)
f$ = "10"
For i = 0 To 9
    g$ = "1" + String$(i, "0")
    Print "f$ = "; Chr$(34); "10"; Chr$(34); " g$ = "; Chr$(34); g$; Chr$(34);
    If Len(f$) And Len(g$) Then
        Print , , " Both equal.";
    End If
    Print
Next
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#3
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.
Reply
#4
Yep that's when!

   
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#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
#6
See how I set that up for you Steve? Smile

I knew AND was a bit thing but I was guessing it would be every other one that would "be equal" like odd and even numbers or a byte thing... but 2 on then 2 off... more that just one bit then but NOT a whole byte. Its the comparing to len(f$) = 2 then, OK. 


So lets try len(f$) = 7
Code: (Select All)
f$ = "1000000"
For i = 0 To 9
    g$ = "1" + String$(i, "0")
    Print i; "f$ = "; Chr$(34); "10"; Chr$(34); " g$ = "; Chr$(34); g$; Chr$(34);
    If Len(f$) And Len(g$) Then
        Print , , " Both equal.";
    End If
    Print
Next

Calling them " Both equal.", still f's with the mind!  LOL
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


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

Forum Jump:


Users browsing this thread: