Home

falsey

Falsey is a term used in programming to describe values that evaluate to false in a boolean context. The spelling falsey is common, though many communities also use falsy; both refer to the same concept of values that do not pass a truth test.

The exact set of falsey values is language dependent, but several patterns recur. In JavaScript, falsey values

Implications of falsey values appear most directly in conditional statements, where a falsey value will skip

See also: falsy values, truthiness, type coercion.

include
false,
0,
-0,
0n
(zero
BigInt),
"",
null,
undefined,
and
NaN.
All
other
values
evaluate
to
true
in
a
conditional
sense.
In
Python,
falsey
values
include
False,
None,
0,
0.0,
0j,
'',
(),
[],
{},
set(),
and
other
empty
containers;
nonempty
or
nonzero
values
are
truthy.
In
Ruby,
only
false
and
nil
are
falsey;
everything
else
is
considered
truthy.
In
PHP,
falsey
values
include
false,
0,
0.0,
'',
'0',
[],
and
null,
with
type
juggling
causing
some
surprising
cases
(for
example,
the
string
"0"
is
considered
falsey).
the
corresponding
branch,
while
a
truthy
value
will
execute
it.
Developers
must
understand
a
language’s
rules
for
truthiness
to
avoid
logical
errors,
especially
when
performing
type
coercion
or
testing
user
input.