> For the complete documentation index, see [llms.txt](https://chihaolu.gitbook.io/all-in-one-solidity/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chihaolu.gitbook.io/all-in-one-solidity/part-i-basic/chapter-2-xing-bie-types-bian-shu-variables/bool.md).

# 【Bool】

在 Solidity 中的布林值以 `true` 和 `false` 表示，但其實 Boolean 只是一個 binary type。

```solidity
pragma solidity ^0.8.11;
contract MyBoolean {
    bool public myBoolean = false;
}
```

可以使用反面表述：`myVar = !myVar`。也可以使用邏輯運算：`&&`, `||`。
