- Sep 2024
-
github.com github.com
-
false is a perfectly non-nil object, and you're excluding it out of convenience!
-
- 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. -
nil
I appreciate the attention to detail of returning nil if that's what should be returned (rather than accidentally just returning the return value from the last line of code,
errors.add
.
-
- Sep 2022
-
www.postgresql.org www.postgresql.org
-
Otherwise behaves according to the value of null_value_treatment which must be one of 'raise_exception', 'use_json_null', 'delete_key', or 'return_target'. The default is 'use_json_null'.
-
- Nov 2021
-
-
Check whether a value is defined (non-nullable), meaning it is neither `null` or `undefined`. This can be useful as a type guard, as for example, `[1, null].filter(Boolean)` does not always type-guard correctly.
-
- Sep 2021
-
twitter.com twitter.com
-
Jonathan Robinson on Twitter. (n.d.). Twitter. Retrieved 6 September 2021, from https://twitter.com/jon_m_rob/status/1431734411335176199
-
- Jul 2021
-
www.postgresql.org www.postgresql.org
-
(The null result should not be confused with a SQL NULL; see the examples.)
-