Conversions - Boolean, Integer and Byte.
There are many parts of "language" that, while I don't really understand the underlying rules, I just accept them in my life. Here's some conversions between Boolean, Int and Byte which, while they work, I don't fully understand the rules governing them:
Dim b1 As Boolean = True Dim i As Integer = b1 Dim byt As Byte = b1 ' Converting Boolean's to Byte's and Int's produces different values Debug.WriteLine(i) ' - 1 Debug.WriteLine(byt) ' 255 ' Even though True converts to int -1 and False converts to int 0, ' casting every int value other than zero converts to boolean True Dim i2 As Integer = 1 Dim i3 As Integer = -600001.567 Dim b2 As Boolean = CBool(i2) Dim b3 As Boolean = CBool(i3) Debug.WriteLine(b2) ' True Debug.WriteLine(b3) ' True