# Тип bool

Цей тип зберігає результат деякого твердження (істинність чи хибність). Наприклад:

```cpp
#include <iostream>

int main()
{
    std::cout << std::boolalpha; // Необхідно, щоб значення bool виводилися словами.
    
    bool isThreeIsGreaterThanFive{3 > 5};
    std::cout << "Is 3 > 5 : " << isThreeIsGreaterThanFive << std::endl;
    
    bool isThreeIsLessThanFive{3 < 5};
    std::cout << "Is 3 < 5 : " << isThreeIsLessThanFive << std::endl;
    
    bool isThreeEqualFive{3 == 5};
    std::cout << "Is 3 == 5 : " << isThreeEqualFive << std::endl;
    
    bool isThreeEqualThree{3 == 3};
    std::cout << "Is 3 == 3 : " << isThreeEqualThree << std::endl;
    
    bool isThreeNotEqualFive{3 != 5};
    std::cout << "Is 3 != 5 : " << isThreeNotEqualFive << std::endl;
}
```

Як ми бачимо, результатом порівняння (оператори більше `>`, більше або дорівнює `>=`, меньше`<`, меньше або дорівнює `<=`, дорівнює `==`, не рівно `!=`) є значення типу `bool`.

Також до двох значень типу `bool` можна застосовувати оператори: заперечення `!` (яке перетворює `true` у `false` та `false` у `true`), логічне "АБО" `||` (результатом якого є `true` якщо хоча б один з операндів містить `true`), лоігчне "І" `&&` (результатом якого є `true` якщо усі операнди містять `true`). Наприклад:

|             Вираз             | Результат |
| :---------------------------: | --------- |
|            `!true`            | `false`   |
|            `!false`           | `true`    |
|       `false \|\| false`      | `false`   |
|       `true \|\| false`       | `true`    |
|        `true && false`        | `false`   |
|         `true && true`        | `true`    |
|        `true && !false`       | `true`    |
| `(true && !false) \|\| false` | `true`    |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pllug-community.gitbook.io/pllug-c-qt-roadmap-book/mova-s++-shvidkii-vstup-ta-obrani-temi/zminni.-deyaki-z-osnovnikh-tipiv-ta-yikh-zastosuvannya./tip-bool.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
