There are numerous, built-in, data types in the Arduino programming language. In this section, we will look at the most commonly used ones. Let's begin by looking at the Boolean type.
Data types
Boolean
The Boolean data type can contain one of two possible values, true or false. The following example shows how to declare a variable to be of the Boolean type:
boolean myBool = true;
The preceding code declares a variable named myBool of the Boolean type and sets an initial value of true. Boolean types are used a lot within a standard Arduino program and all comparison operations, as we will see later in this chapter, return a Boolean value.