From a76da2103363c5fff7a46b14de51244e591a51aa Mon Sep 17 00:00:00 2001 From: Colin Caine Date: Fri, 21 Jun 2024 15:16:58 +0100 Subject: [PATCH 1/2] docs: typo: highlight 'with' as code --- lib/elixir/lib/kernel/special_forms.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/elixir/lib/kernel/special_forms.ex b/lib/elixir/lib/kernel/special_forms.ex index acb062cd694..e5ddfdc26a4 100644 --- a/lib/elixir/lib/kernel/special_forms.ex +++ b/lib/elixir/lib/kernel/special_forms.ex @@ -1539,7 +1539,7 @@ defmodule Kernel.SpecialForms do @doc """ Combine matching clauses. - One of the ways to understand with is to show which code + One of the ways to understand `with` is to show which code patterns it improves. Imagine you have a map where the fields `width` and `height` are optional and you want to compute its area, as `{:ok, area}` or return `:error`. We could implement From 3d9080694792c5a0e520ca5a033c725103fc5f8f Mon Sep 17 00:00:00 2001 From: Colin Caine Date: Fri, 21 Jun 2024 15:18:36 +0100 Subject: [PATCH 2/2] docs: an 'else' is like a 'case', not a clause --- lib/elixir/lib/kernel/special_forms.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/elixir/lib/kernel/special_forms.ex b/lib/elixir/lib/kernel/special_forms.ex index e5ddfdc26a4..9dfa73f2f41 100644 --- a/lib/elixir/lib/kernel/special_forms.ex +++ b/lib/elixir/lib/kernel/special_forms.ex @@ -1661,7 +1661,7 @@ defmodule Kernel.SpecialForms do ...> end {:error, :wrong_data} - The `else` block works like a `case` clause: it can have multiple clauses, + The `else` block works like a `case`: it can have multiple clauses, and the first match will be used. Variables bound inside `with` (such as `width` in this example) are not available in the `else` block.