- Sep 2024
-
en.wikipedia.org en.wikipedia.org
-
the first operand evaluated to a value likened to logically false, in other words, a falsy value
Tags
Annotators
URL
-
- Dec 2023
-
www.pluralsight.com www.pluralsight.com
-
&& nil
first sighting: I don't think I've seen someone write exactly
&& nil
before.Apparently to avoid having the return value from
errors.add
— which should be done solely for its side effect, not to get a return value -- inadvertently being used as a return value foruser
. It wouldn't make sense to return fromuser
. That should only return a User or nil. And more statically typed languages would allow that to be expressed/enforced from type annotations alone, which would have caught the mistake of returningerrors.add
if someone had accidentally attempted to return that.Having
user
(and thereforecall
) return nil is key to theunless @current_user
working.
-
- Oct 2020
-
rollupjs.org rollupjs.orgRollup1
-
Returning null defers to other resolveId functions and eventually the default resolution behavior; returning false signals that source should be treated as an external module and not included in the bundle.
I like how null and false, although both falsy, can be treated differently when a useful need for such distinction, such as this case, arises.
Tags
Annotators
URL
-
- Jul 2020
-
developer.mozilla.org developer.mozilla.orgFalsy1