
Getting Started with V Programming
By :

A Boolean is a data type that is used to represent one of the two possible values, true
or false
. The following code demonstrates the declaration of a Boolean variable:
completed := true
From the preceding statement, we notice that the Boolean variable named completed
is assigned with a value true
. Notice that there are no quotes on the right-hand side of the statement. Declaring Boolean variables just needs either of the two values true
or false
to be assigned to the variable.
A Boolean data type is represented with the bool
keyword. The usage of the bool
keyword will be seen while defining arguments or return types for functions, or fields of a struct or interfaces.
Logical operators generally evaluate two operands and yield a Boolean result. The logical operator requires its operands to be of type bool
.
Table 4.1 – Logical operators
The following code shows that performing various logical operations...