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

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.

主站蜘蛛池模板: 县级市| 含山县| 永顺县| 专栏| 河北省| 前郭尔| 长治市| 冕宁县| 五莲县| 耿马| 遵义市| 调兵山市| 栾城县| 平昌县| 响水县| 吉木乃县| 凤凰县| 洛阳市| 永寿县| 肥东县| 霍城县| 福清市| 贵德县| 高邮市| 开江县| 碌曲县| 南昌市| 佛坪县| 临猗县| 郎溪县| 崇阳县| 尼玛县| 商水县| 江孜县| 黔西县| 醴陵市| 新泰市| 海阳市| 调兵山市| 克什克腾旗| 肇源县|