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

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.

主站蜘蛛池模板: 营山县| 华亭县| 丰原市| 玛曲县| 佛学| 平度市| 项城市| 浠水县| 江油市| 盈江县| 龙里县| 中超| 晋州市| 宜兰市| 贺州市| 通州区| 榆中县| 万源市| 且末县| 溧阳市| 宽甸| 镇江市| 宣武区| 恩施市| 朝阳市| 桃园市| 庆云县| 日喀则市| 娄底市| 白城市| 威远县| 阿拉善左旗| 辉南县| 临沭县| 南投市| 衡阳县| 徐汇区| 元阳县| 林西县| 黎平县| 榆树市|