1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* array.c: [DOC] Add note about negative indices in Array overview

By @ckaenzig [Fixes GH-427] https://github.com/ruby/ruby/pull/427


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
zzak 2013-11-07 17:15:49 +00:00
parent bceb856986
commit 6720c0aeeb
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Fri Nov 8 02:14:37 2013 Zachary Scott <e@zzak.io>
* array.c: [DOC] Add note about negative indices in Array overview
By @ckaenzig [Fixes GH-427] https://github.com/ruby/ruby/pull/427
Fri Nov 8 02:09:12 2013 Zachary Scott <e@zzak.io> Fri Nov 8 02:09:12 2013 Zachary Scott <e@zzak.io>
* lib/csv.rb: [DOC] Fix typo in CSV.parse_line by @funky-bibimbap * lib/csv.rb: [DOC] Fix typo in CSV.parse_line by @funky-bibimbap

View file

@ -5404,7 +5404,8 @@ rb_ary_drop_while(VALUE ary)
* *
* Elements in an array can be retrieved using the Array#[] method. It can * Elements in an array can be retrieved using the Array#[] method. It can
* take a single integer argument (a numeric index), a pair of arguments * take a single integer argument (a numeric index), a pair of arguments
* (start and length) or a range. * (start and length) or a range. Negative indices start counting from the end,
* with -1 being the last element.
* *
* arr = [1, 2, 3, 4, 5, 6] * arr = [1, 2, 3, 4, 5, 6]
* arr[2] #=> 3 * arr[2] #=> 3
@ -5412,6 +5413,7 @@ rb_ary_drop_while(VALUE ary)
* arr[-3] #=> 4 * arr[-3] #=> 4
* arr[2, 3] #=> [3, 4, 5] * arr[2, 3] #=> [3, 4, 5]
* arr[1..4] #=> [2, 3, 4, 5] * arr[1..4] #=> [2, 3, 4, 5]
* arr[1..-3] #=> [2, 3, 4]
* *
* Another way to access a particular array element is by using the #at method * Another way to access a particular array element is by using the #at method
* *