C++ TutorialLesson 13Free preview
C++ Booleans
This lesson is part of C++ · All levels
Summary
This lesson discusses the boolean data type that only stores true or false values. The Boolean becomes the basis of all branching conditions and statements in a program, because every comparison always yields a boolean. You also learn to use logic operators to combine several conditions at once.
Key points
- The bool type has two values: true (1) and false (0).
- Comparison results like >, <, == are always boolean.
- The operator && is only valid if both sides are true.
- The operator is of the value true when one side is right, and! reverses the value.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.