< Day Day Up > |
The Boolean data type can store the two Boolean values "true" and "false." The Boolean data type is primarily used in conditional statements such as If or While , since the comparison operators (such as < or = ) result in a Boolean value. For example, in the following function, the Negative local variable determines what is printed. Table 3-1. Fundamental Types
Dim a As Integer Dim Negative As Boolean a = 10 - 20 Negative = a < 0 If Negative Then Console.WriteLine("Less than zero.") Else Console.WriteLine("Greater than or equal to zero.") End If The Boolean values "true" and "false" are represented by the literals True and False , respectively. The default value of Boolean is the literal False . |
< Day Day Up > |