true | false

[Constants]

There are two constants used to represent truth and falsity in the Arduino language: true, and false.

true

true is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is true, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense.

Note that the true and false constants are typed in lowercase unlike HIGH, LOW, INPUT, and OUTPUT.

false

false is the easier of the two to define. false is defined as 0 (zero).

Note that the true and false constants are typed in lowercase unlike HIGH, LOW, INPUT, and OUTPUT.

See also