[DOC] Add an example of the splat operator with a non-array object (#7098)
This commit is contained in:
parent
f03dd4ee77
commit
619af4fd64
Notes:
git
2023-02-15 03:44:15 +00:00
Merged-By: hsbt <hsbt@ruby-lang.org>
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user