Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Truth value
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Computing == {{see also|Implicit type conversion}} In some programming languages, any [[Expression (computer science)|expression]] can be evaluated in a context that expects a [[Boolean data type]]. Typically (though this varies by programming language) expressions like the number [[zero]], the [[empty string]], empty lists, and [[Null pointer|null]] are treated as false, and strings with content (like "abc"), other numbers, and objects evaluate to true. Sometimes these classes of expressions are called '''falsy''' and '''truthy'''. For example, in [[Lisp (programming language)|Lisp]], [[Null pointer|nil]], the empty list, is treated as false, and all other values are treated as true. In [[C (programming language)|C]], the number 0 or 0.0 is false, and all other values are treated as true. In [[JavaScript]], the empty string (<code>""</code>), <code>null</code>, <code>undefined</code>, [[NaN|<code>NaN</code>]], +0, [[β0]] and <code>false</code><ref>{{cite web |url=http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf |title=ECMAScript Language Specification |page=43 |url-status=dead |archive-url=https://web.archive.org/web/20150412040502/http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf |archive-date=2015-04-12 |access-date=2011-03-12 }}</ref> are sometimes called ''falsy'' (of which the [[Complement (set theory)|complement]] is ''truthy'') to distinguish between strictly [[Type safety|type-checked]] and [[Type conversion|coerced]] Booleans (see also: [[JavaScript syntax#Type conversion]]).<ref>{{cite web |url=http://javascript.crockford.com/style2.html |title=The Elements of JavaScript Style |publisher=Douglas Crockford |access-date=5 March 2011 |url-status=live |archive-url=https://web.archive.org/web/20110317074944/http://javascript.crockford.com/style2.html |archive-date=17 March 2011 }}</ref> As opposed to Python, empty containers (Arrays, Maps, Sets) are considered truthy. Languages such as [[PHP]] also use this approach.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Truth value
(section)
Add topic