Escape Binding
reference in pattern matching docs
This commit is contained in:
parent
80ab42462e
commit
99503ab975
Notes:
git
2025-03-21 01:36:29 +00:00
@ -221,7 +221,7 @@ For hash patterns, even a simpler form exists: key-only specification (without a
|
||||
end
|
||||
#=> "matched: 1"
|
||||
|
||||
Binding works for nested patterns as well:
|
||||
\Binding works for nested patterns as well:
|
||||
|
||||
case {name: 'John', friends: [{name: 'Jane'}, {name: 'Rajesh'}]}
|
||||
in name:, friends: [{name: first_friend}, *]
|
||||
@ -249,7 +249,7 @@ The "rest" part of a pattern also can be bound to a variable:
|
||||
end
|
||||
#=> "matched: 1, {b: 2, c: 3}"
|
||||
|
||||
Binding to variables currently does NOT work for alternative patterns joined with <code>|</code>:
|
||||
\Binding to variables currently does NOT work for alternative patterns joined with <code>|</code>:
|
||||
|
||||
case {a: 1, b: 2}
|
||||
in {a: } | Array
|
||||
|
Loading…
x
Reference in New Issue
Block a user