Creating an Array: Difference between revisions
Content added Content deleted
(Properly ordering the languages) |
|||
Line 178: | Line 178: | ||
my_array = Array.new |
my_array = Array.new |
||
# This is the most basic way to create an empty one-dimensional array in Ruby. |
# This is the most basic way to create an empty one-dimensional array in Ruby. |
||
my_array = 1, 2, 3, 4, 5 |
|||
# Ruby treats comma separated values on the right hand side of assignment as array. You could optionally surround the list with square bracks |
|||
# my_array = [ 1, 2, 3, 4, 5 ] |
|||
array = [ |
array = [ |