Project

General

Profile

Actions

Misc #14673

closed

Documentation for `Array#drop` / `drop_while` unclear in regard to modification

Misc #14673: Documentation for `Array#drop` / `drop_while` unclear in regard to modification

Added by sos4nt (Stefan Schüßler) over 8 years ago. Updated 9 days ago.

Status:
Closed
Assignee:
-
[ruby-core:86489]

Description

The documentation for Array#drop says:

Drops first n elements from ary and returns the rest of the elements in an array.

It's unclear if the receiver is being changed or not (it is not). The documentation should be more explicit in that regard.

Maybe something like "Returns a new array containing all except the first n elements from ary".

This also applies to Array#drop_while.

Updated by Earlopain (Earlopain _) 9 days ago Actions #1 [ruby-core:126412]

  • Status changed from Open to Closed

Docs today say this:

Returns a new array containing all but the first count element of self, where count is a non-negative integer; does not modify self.

Actions

Also available in: PDF Atom