We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7fcdecd commit 1d13d18Copy full SHA for 1d13d18
lib/elixir/lib/kernel/special_forms.ex
@@ -480,7 +480,7 @@ defmodule Kernel.SpecialForms do
480
defmacro __DIR__
481
482
@doc """
483
- Access an already bound variable in match clauses.
+ Accesses an already bound variable in match clauses.
484
485
## Examples
486
@@ -499,7 +499,14 @@ defmodule Kernel.SpecialForms do
499
iex> ^x = 2
500
** (MatchError) no match of right hand side value: 2
501
502
- Note the `^` special form is only useful in matches.
+ Note that `^` always refers to the value of x prior to the match. The
503
+ following example will match:
504
+
505
+ iex> x = 0
506
+ iex> { x, ^x } = { 1, 0 }
507
+ iex> x
508
+ 1
509
510
"""
511
defmacro ^(var)
512
0 commit comments