Arrays can be created by enclosing a list of elements in square brackets ([
and ]
). Array elements in this notation are separated with commas:
array = [1, 2, 3, 4]
Arrays can contain any kind of objects in any combination with no restrictions on type:
array = [1, 'b', nil, [3, 4]]