8000 docs for creating arrays · Fryguy/ruby@56abb1c · GitHub
[go: up one dir, main page]

Skip to content

Commit 56abb1c

Browse files
committed
docs for creating arrays
* array.c: [DOC] add example for Array.new with block and index. Reported by Don Cruickshank. [ruby-core:68442] [Bug ruby#10944] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 719262e commit 56abb1c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

array.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5926,7 +5926,8 @@ rb_ary_sum(int argc, VALUE *argv, VALUE ary)
59265926
* This method is safe to use with mutable objects such as hashes, strings or
59275927
* other arrays:
59285928
*
5929-
* Array.new(4) { Hash.new } #=> [{}, {}, {}, {}]
5929+
* Array.new(4) { Hash.new } #=> [{}, {}, {}, {}]
5930+
* Array.new(4) {|i| i.to_s } #=> ["0", "1", "2", "3"]
59305931
*
59315932
* This is also a quick way to build up multi-dimensional arrays:
59325933
*

0 commit comments

Comments
 (0)
0