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

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.

主站蜘蛛池模板: 毕节市| 广平县| 新密市| 安宁市| 郁南县| 双江| 炉霍县| 尉犁县| 鹤壁市| 广安市| 个旧市| 江川县| 常宁市| 南川市| 额尔古纳市| 大冶市| 东源县| 平罗县| 漠河县| 英山县| 合阳县| 阿拉善右旗| 津南区| 本溪市| 运城市| 博白县| 旬邑县| 石首市| 襄垣县| 托克托县| 天峨县| 吉隆县| 安多县| 乌兰浩特市| 苍山县| 青龙| 资阳市| 诸暨市| 平舆县| 西宁市| 河北省|