Ruby arrays are ordered collections of objects. They can hold objects like integer, number, hash, string, symbol or any other array.
Its indexing starts with 0. The negative index starts with -1 from the end of the array. For example, -1 indicates last element of the array and 0 indicates first element of the array.
A Ruby array is created in many ways.
- Using literal constructor []
- Using new class method