Skip to content

Commit

Permalink
Merge pull request #41 from j0urneyK/main
Browse files Browse the repository at this point in the history
Update capture operator example in Elixir documentation
  • Loading branch information
wintermeyer authored Jan 28, 2024
2 parents 81005e0 + 6439277 commit 2a77e83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/ROOT/pages/elixir/operators/capture-operator.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ You can also use the Capture operator to reference named functions from modules.

[source,elixir]
----
iex> len = &List.length/1
&List.length/1
iex> len = &length/1
&:erlang.length/1
iex> len.([1, 2, 3, 4, 5])
5
----

In the example above, `&List.length/1` captures the `length` function from the `List` module, which takes one argument (`/1`). This function is then assigned to the variable `len`.
In the example above, `&length/1` captures the `length` function from the which takes one argument (`/1`). This function is then assigned to the variable `len`.

0 comments on commit 2a77e83

Please sign in to comment.