官术网_书友最值得收藏!

Boolean

The Boolean type represents a true or false value. Some languages don't provide a bool type, and you have to use an integer or define your own enumeration, but Go conveniently comes with a predeclared bool type. The true and false constants are also predefined and used in all lowercase. Here is an example of creating a Boolean:

var customFlag bool = false  

The bool type is not unique to Go by any means, but one interesting piece of trivia about the Boolean type is that it's the only type named after a person. George Boole lived from 1815 to 1864 and wrote The Laws of Thought, where he described Boolean algebra, which is what all digital logic is based upon. The bool type is very simple in Go, but the history behind the name is very rich.

主站蜘蛛池模板: 扶风县| 九寨沟县| 静宁县| 海门市| 股票| 西宁市| 黄陵县| 呈贡县| 满洲里市| 图片| 莱阳市| 赤城县| 江门市| 罗平县| 凤阳县| 剑河县| 青阳县| 彭阳县| 辉县市| 赤峰市| 习水县| 盘锦市| 平邑县| 旬邑县| 伊通| 全南县| 桐梓县| 邓州市| 晋宁县| 织金县| 保靖县| 若尔盖县| 白河县| 都兰县| 河津市| 定兴县| 凤翔县| 民县| 徐汇区| 家居| 广饶县|