What is the use of array in Ruby?

An Array is a sequential collection of items, where each item is placed at a unique index or we can say where each item can be indexed. Unlike many other languages, in Ruby a single Array can hold items of mixed data types such as strings, integers and floats or even a method-call which returns some value. See an example below:

arr = [1,’ten’, 10.2, array_size( a0 ) ]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.