This question originates from here. I tried this statement in VS to see what happens:
Len(Name <= 3)
According to this answer and also this one, Boolean should consume 4 bytes. According to MSDN, Len Function in VB
Returns an integer containing either the number of characters in a string or the nominal number of bytes required to store a variable.
Name <= 3
should convert 3 to String and perform string comparison, returning a boolean value, so Len
should evaluate number of bytes in it, which should be 4. For some reason, above code returns 2, regardless of the second parameter. In other words, Len(True)
also returns 2. Tried for different platform targets (32 and 64) - same thing.
Why does Len(Boolean)
return 2 instead of 4?