Skip to content

Commit 4b9a2bb

Browse files
authored
Improve links in pattern matching page (#10322)
1 parent 3a876ca commit 4b9a2bb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/elixir/pages/patterns-and-guards.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This page describes the semantics of patterns and guards, where they are all all
66

77
## Patterns
88

9-
Patterns in Elixir are made of variables, literals, and data-structure specific syntax. One of the most used constructs to perform pattern matching is the match operator (`=`):
9+
Patterns in Elixir are made of variables, literals, and data-structure specific syntax. One of the most used constructs to perform pattern matching is the match operator ([`=`](`=/2`)):
1010

1111
```iex
1212
iex> x = 1
@@ -156,7 +156,7 @@ iex> [head | tail] = []
156156
** (MatchError) no match of right hand side value: []
157157
```
158158

159-
Given charlists are represented as a list of integers, one can also perform prefix matches on charlists using the list concatenation operator (`++`):
159+
Given charlists are represented as a list of integers, one can also perform prefix matches on charlists using the list concatenation operator ([`++`](`++/2`)):
160160

161161
```elixir
162162
iex> 'hello ' ++ world = 'hello world'
@@ -207,7 +207,7 @@ Finally, note map keys in patterns must always be literals or previously bound v
207207

208208
### Binaries
209209

210-
Binaries may appear in patterns using the double less-than/greater-than syntax (`<<>>`). A binary in a pattern can match multiple segments at the same, each with different type, size, and unit:
210+
Binaries may appear in patterns using the double less-than/greater-than syntax ([`<<>>`](`<<>>/1`)). A binary in a pattern can match multiple segments at the same, each with different type, size, and unit:
211211

212212
```iex
213213
iex> <<val::unit(8)-size(2)-integer>> = <<123, 56>>
@@ -216,9 +216,9 @@ iex> val
216216
31544
217217
```
218218

219-
See the documentation for `<<>>` for a complete definition of pattern matching for binaries.
219+
See the documentation for [`<<>>`](`<<>>/1`) for a complete definition of pattern matching for binaries.
220220

221-
Finally, remember that strings in Elixir are UTF-8 encoded binaries. This means that, similar to charlists, prefix matches on strings are also possible with the binary concatenation operator (`<>`):
221+
Finally, remember that strings in Elixir are UTF-8 encoded binaries. This means that, similar to charlists, prefix matches on strings are also possible with the binary concatenation operator ([`<>`](`<>/2`)):
222222

223223
```elixir
224224
iex> "hello " <> world = "hello world"
@@ -380,7 +380,7 @@ Check.empty?({})
380380

381381
## Where patterns and guards can be used
382382

383-
In the examples above, we have used the match operator (`=`) and function clauses to showcase patterns and guards respectively. Here is the list of the built-in constructs in Elixir that support patterns and guards.
383+
In the examples above, we have used the match operator ([`=`](`=/2`)) and function clauses to showcase patterns and guards respectively. Here is the list of the built-in constructs in Elixir that support patterns and guards.
384384

385385
* `match?/2`:
386386

@@ -428,7 +428,7 @@ In the examples above, we have used the match operator (`=`) and function clause
428428

429429
* custom guards can also be defined with `defguard/1` and `defguardp/1`. A custom guard can only be defined based on existing guards.
430430

431-
Note that the match operator (`=`) does *not* support guards:
431+
Note that the match operator ([`=`](`=/2`)) does *not* support guards:
432432

433433
```elixir
434434
{:ok, binary} = File.read("some/file")

0 commit comments

Comments
 (0)