summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorKazuki Tsujimoto <kazuki@callcc.net>2021-08-19 17:03:17 +0900
committerKazuki Tsujimoto <kazuki@callcc.net>2021-08-19 17:07:58 +0900
commitecb6d6a4ef058b5598a7633c3921eeab08ce11c6 (patch)
tree0df5b09fae002fff45b63ccf6ca3afc07a9a9bae /doc
parent00d66f7ec215406b5977fb490b06dae71a4fede6 (diff)
Allow omission of parentheses in one line pattern matching [Feature #16182]
Diffstat (limited to 'doc')
-rw-r--r--doc/syntax/pattern_matching.rdoc8
1 files changed, 7 insertions, 1 deletions
diff --git a/doc/syntax/pattern_matching.rdoc b/doc/syntax/pattern_matching.rdoc
index f80703d5c6..b7d614770c 100644
--- a/doc/syntax/pattern_matching.rdoc
+++ b/doc/syntax/pattern_matching.rdoc
@@ -140,7 +140,7 @@ Both array and hash patterns support "rest" specification:
end
#=> "matched"
-In +case+ (but not in <code>=></code> and +in+) expressions, parentheses around both kinds of patterns could be omitted:
+Parentheses around both kinds of patterns could be omitted:
case [1, 2]
in Integer, Integer
@@ -158,6 +158,12 @@ In +case+ (but not in <code>=></code> and +in+) expressions, parentheses around
end
#=> "matched"
+ [1, 2] => a, b
+ [1, 2] in a, b
+
+ {a: 1, b: 2, c: 3} => a:
+ {a: 1, b: 2, c: 3} in a:
+
Find pattern is similar to array pattern but it can be used to check if the given object has any elements that match the pattern:
case ["a", 1, "b", "c", 2]