aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
diff options
context:
space:
mode:
authorstomar <stomar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-20 20:30:25 +0000
committerstomar <stomar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-20 20:30:25 +0000
commit60af6db4ecc9fbef25efd9f629ea07f8c193e4b4 (patch)
tree8f638f3c68721e9339136dd210295dbbc035b9ac /array.c
parent5b359dc33e88785e55517a1e3255e2a1b27f29c6 (diff)
downloadruby-60af6db4ecc9fbef25efd9f629ea07f8c193e4b4.tar.gz
docs for creating arrays
* array.c: [DOC] add example for Array.new with block and index. Reported by Don Cruickshank. [ruby-core:68442] [Bug #10944] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/array.c b/array.c
index 9528ea59b6..bd24216af3 100644
--- a/array.c
+++ b/array.c
@@ -5926,7 +5926,8 @@ rb_ary_sum(int argc, VALUE *argv, VALUE ary)
* This method is safe to use with mutable objects such as hashes, strings or
* other arrays:
*
- * Array.new(4) { Hash.new } #=> [{}, {}, {}, {}]
+ * Array.new(4) { Hash.new } #=> [{}, {}, {}, {}]
+ * Array.new(4) {|i| i.to_s } #=> ["0", "1", "2", "3"]
*
* This is also a quick way to build up multi-dimensional arrays:
*