Note that or works for nested attribute access

This commit is contained in:
Vincent Ambo 2020-11-25 13:41:38 +01:00
parent 3236b7ff28
commit d28d30477a

View file

@ -348,7 +348,7 @@ in set.a or 23
Since the attribute `a` exists, this will return `42`. Since the attribute `a` exists, this will return `42`.
``` ```nix
# ... or fall back to a default if there is no such key # ... or fall back to a default if there is no such key
let set = { }; let set = { };
in set.a or 23 in set.a or 23
@ -357,6 +357,8 @@ in set.a or 23
Since the attribute `a` does not exist, this will fall back to returning the Since the attribute `a` does not exist, this will fall back to returning the
default value `23`. default value `23`.
Note that `or` expressions also work for nested attribute set access.
# Standard libraries # Standard libraries
Yes, libraries, plural. Yes, libraries, plural.