Types/bool: Difference between revisions
Jump to navigation
Jump to search
(Rewrite to prevent a very bad potential mistake) |
m (code tags, small grammar changes) |
||
Line 1: | Line 1: | ||
A variable type which can have one of two values: true or false. Care must be observed with the concepts of "truthy" and "falsey": different types | A variable type which can have one of two values: <code>true</code> or <code>false</code>. Care must be observed with the concepts of "truthy" and "falsey": different types may behave like <code>true</code> in a boolean context, and <code>nil</code> may act like <code>false</code>, but they are not equal. Especially significant: <code>"true"</code> and <code>"false"</code> are truthy [[Types/string]]s, different from <code>true</code> and <code>false</code>. | ||
Used in Boolean algebra, which is the foundation of digital logic and processing. | Used in Boolean algebra, which is the foundation of digital logic and processing. | ||
Wikipedia has a comprehensive article on [http://en.wikipedia.org/wiki/Boolean Booleans] | Wikipedia has a comprehensive article on [http://en.wikipedia.org/wiki/Boolean Booleans] |
Revision as of 20:58, 28 December 2021
A variable type which can have one of two values: true
or false
. Care must be observed with the concepts of "truthy" and "falsey": different types may behave like true
in a boolean context, and nil
may act like false
, but they are not equal. Especially significant: "true"
and "false"
are truthy Types/strings, different from true
and false
.
Used in Boolean algebra, which is the foundation of digital logic and processing.
Wikipedia has a comprehensive article on Booleans