## The Type bool [1/9]

### The Type bool

The type **bool** has only two values:
**true** and **false**.

true and false are **literal expressions**.
Every literal expression is a primary expression.

Operator **not**
turns true into false and reverse.

Here is another simple example.

The expressions on the left and right side of operator or are its **operands**.

Operator **or**
returns true when either of its operands
is true.

Operator **and**
returns true only when both of its operands
are true.

* * *

-- The Importance of Types --

The notion of **types** in programming languages allows for manipulating various kinds of values besides
numbers. The type bool can be used to express truth values
true and false.
The type color allows for manipulating colors.
There are many other types for representing various values,
for example types for strings, positions, motions, images, input events, and there are also
parametric types, user-defined types and various kinds of abstract types.

Types are a crucial aspect of programming languages. Types describe data.

The result of comparison operators is a value of type bool.

* * *

The expression not(7<>7) must use parentheses because of the priority of operator not. If this expression is written witout parentheses, as not 7<>7, then it is equivalent to (not 7)<>7, which doesn't make any sense.

Normally, instead of writing not(7<>7), one would simply write a simpler but equivalent expression 7=7.

The problem arises when a programmer wants to negate the expression 7=7, so he/she writes not 7=7, which is incorrect. This expression can be correctly written as not(7=7), or simply as 7<>7.

* * *

The inequality operator <> can be written in an altentative way as !=.

The equality operator = can be written in an altentative way as ==.

The isPressed function returns a value of type bool.

Single quotation marks (') can be used instead of double quotation marks (") to delimit strings.

Here is another example.

In this example, the value of variable b is true when the F key is pressed. When the F key is not pressed, the value of variable b equals false.

The symbol **!** can be used instead of
the keyword not.