arr [ ]
Try it yourself →A collection of values.
Syntax
name = [e1, e2, ...]
Description
Array with square brackets. Elements are accessed with 0-based indexing; -1 is the last element.
Example
colors = ["red", "purple", "green"] puts colors[0] puts colors[-1] puts colors.length
Expected output
red green 3
When to use?
Storing lists.