Home

falsiness

Falsiness is a term used mainly in programming to describe the quality of a value that is interpreted as false in a boolean context. In many languages there is a related notion called truthiness, describing values that evaluate to true. Falsiness results from type coercion and the semantics of boolean expressions, and it is distinct from the philosophical notion of falsity, which refers to a false proposition.

Language-specific rules determine which values are falsy. In JavaScript, for example, false, 0, -0, 0n, '', null,

Practical effects include short-circuit evaluation and the risk of subtle bugs from implicit coercion. Programmers often

Related concepts include truthiness, boolean types, and falsity.

undefined,
and
NaN
are
falsy.
In
Python,
the
values
False
and
None,
the
number
0
and
0.0,
empty
strings
and
containers
('',
[],
{},
set(),
etc.)
are
falsy,
while
other
values
are
truthy.
Ruby
treats
only
false
and
nil
as
falsy;
everything
else
is
truthy.
PHP
considers
false,
0,
0.0,
'',
'0',
null,
and
empty
arrays
as
falsy,
with
non-empty
strings
being
truthy.
write
explicit
checks
or
use
strict
comparisons
to
avoid
unintended
truthiness,
and
many
languages
offer
means
to
coerce
values
deliberately
(for
example,
Boolean(value)
or
equivalent).
Understanding
falsiness
helps
in
writing
robust
conditionals
and
in
debugging.