summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorKouhei Yanagita <yanagi@shakenbu.org>2023-02-15 12:43:55 +0900
committerGitHub <noreply@github.com>2023-02-15 12:43:55 +0900
commit619af4fd6404168a368442941ec80e739aef2609 (patch)
tree67dd04ea0555031eb045e7462fca4fbb01747d49 /doc
parentf03dd4ee778cbed7ea9510385b9bbdbdcf6d485b (diff)
downloadruby-619af4fd6404168a368442941ec80e739aef2609.tar.gz
[DOC] Add an example of the splat operator with a non-array object (#7098)
Diffstat (limited to 'doc')
-rw-r--r--doc/syntax/assignment.rdoc4
1 files changed, 4 insertions, 0 deletions
diff --git a/doc/syntax/assignment.rdoc b/doc/syntax/assignment.rdoc
index 037c2032a8..e30cb35adf 100644
--- a/doc/syntax/assignment.rdoc
+++ b/doc/syntax/assignment.rdoc
@@ -403,6 +403,10 @@ assigning. This is similar to multiple assignment:
p a # prints [1, 2, 3]
+ b = *1
+
+ p b # prints [1]
+
You can splat anywhere in the right-hand side of the assignment:
a = 1, *[2, 3]