# Boolean values

LotusScript® recognizes the Boolean values True and False, which it evaluates as -1 and 0, respectively. When you assign a Boolean value to a variable of type Variant, you can display that value as text ("True" or "False") or as an integer (-1 or 0).

Note: As of LotusScript® 5.0 (Domino/Notes 6.0), LotusScript® also has a Boolean data type. This data type is used for variables with values of True (-1) or False (0).

``````Dim varV As Variant
varV = 1 > 2      ' The expression 1 > 2 (1 is greater than 2)
' evaluates to False, so varV is assigned a
' value of False.
Print varV
' Output: False
Print TypeName(varV) ' Output: BOOLEAN
Print DataType(varV) ' Output: 11
varV = True
Print varV           ' Output: True
Print CInt(varV)     ' Output: -1
Print varV + 2       ' Output: 1``````

You can assign a Boolean value of True or False to a variable of any of the numeric data types that LotusScript® recognizes. LotusScript® converts that value to an integer (-1 or 0).

``````Dim anInt As Integer
varV = True
anInt% = varV
Print anInt%
' Output: 0
Print TypeName(anInt%)
' Output: INTEGER``````

LotusScript® interprets the values -1 and 0 as True and False, respectively.

``````varV = -1
Print varV          ' Output : -1
If varV = True Then Print "varV is True." Else Print _
k "varV is False."
' Output: varV is True.
anInt% = 0
If anInt% = True then Print "True" Else print "False"
' Output: False``````

You can define a constant as a Boolean value.

``````Const YES = True
Print YES
' Output: True
Print TypeName(YES)
' Output: BOOLEAN
Dim varV As Variant
varV = YES
Print varV
' Output: True
Dim anInt As Integer
anInt% = YES
print anInt%
' Output: -1``````