davincicoders/ruby_koans_argroves — pull request #5 by ArGroves (2013-07-31 23:46:38+00:00)
Title: 54146061 about arrays master

- Empty arrays are of size 0.
- An easy way to create an array is to put its contents in square
brackets, separated by commas.
- The << operator is the same as array.push.
- Arrays can be accessed by index, through .first and .last, or
with negative index values, which count backwards from the end of
the array.
- Using two numbers in square brackets, subsections of the array
can be accessed.
- It might be because I have Ruby 1.9, but an array slice starting
at one above the last index returns an empty array. Any arrays
starting at indices above that return nil.
- Ranges are not arrays, but they can be converted into arrays.
- Ranges defined with (..) include the last value, but ranges defined
with (...) do not.
- Array slicing can be done with ranges.
- A negative value at the end of the range will cause the slice to
extend to the end of the array.
- The .push method adds an element to the end of the array.
- The .pop method removes the last element and returns it.
- The .unshift method inserts an element at the front of the array.
- The .shift method removes the first element and returns it.

[#54146061]