From d28d30477a36bb51d797058b9579b105a5168c25 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 25 Nov 2020 13:41:38 +0100 Subject: Note that `or` works for nested attribute access --- nix/nix-1p/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nix/nix-1p/README.md') diff --git a/nix/nix-1p/README.md b/nix/nix-1p/README.md index 0399bc41cd..c8f4b328fa 100644 --- a/nix/nix-1p/README.md +++ b/nix/nix-1p/README.md @@ -348,7 +348,7 @@ in set.a or 23 Since the attribute `a` exists, this will return `42`. -``` +```nix # ... or fall back to a default if there is no such key let set = { }; 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 default value `23`. +Note that `or` expressions also work for nested attribute set access. + # Standard libraries Yes, libraries, plural. -- cgit 1.4.1