Project

General

Profile

Actions

Bug #10944

closed

Documentation of Array.new w.r.t. element index available to a block

Added by dgc (Don Cruickshank) almost 10 years ago. Updated over 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0p353 (2013-11-22 revision 43784) [i386-linux]
[ruby-core:68442]

Description

In http://ruby-doc.org/core-2.2.1/Array.html#class-Array-label-Creating+Arrays

The documentation for the Array.new method is missing the fact that the element index is available to a given block.

E.g.

Array.new(4) { |x| x } #=> [0, 1, 2, 3]

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0