5.5.1.2.2 Let-coercion to and from Boolean
When not stored as a Boolean value, False is represented by 0, and True is represented by nonzero values, usually -1.
The semantics of Boolean Let-coercion depend on the source’s value type and the destination’s declared type:
Source Value Type |
Destination Declared Type |
Semantics |
---|---|---|
Boolean |
Boolean |
The result is a copy of the source value. |
Boolean |
Any numeric type except Byte |
If the source value is False, the result is 0. Otherwise, the result is -1. |
Boolean |
Byte |
If the source value is False, the result is 0. Otherwise, the result is 255. |
Any numeric type |
Boolean |
If the source value is 0, the result is False. Otherwise, the result is True. |