An array is basically a list of elements stored in a container. Each element in the container acts like a variable, and you can inspect and change elements either individually or in groups. A hash is also a list of elements, but it differs from an array because each element in a hash must have what is called a key/value pair - i.e., each element, or key, has a value associated with it. The value can be a number, or a word or phrase (i.e., a string). Below is the basic syntax for creating an array in Ruby:


      
  my_array = ["toys", "lamp", 2, "99 problems", "stacks on stacks on stacks"]
      


And here is the basic syntax for creating a hash in Ruby:


          
  my_hash = { "sample_key" => "sample_value",
      "address" => "1234 anytown USA",
      "favorite candy" => "jelly-beans",
      "number of cats" => 2
  }
      


In sum, at this point it seems to me that a significant difference between a hash and an array is scope- the hash has limitless key/value pairs; but everything is designed around the idea of that pair. The array is simply a limitless list, but each element in the list is treated equally. I’m confident there is much more to learn about the differences between arrays and hashes, and why you’d choose one over the other, and I look forward to expanding on this post as my familiarity and experience with these powerful tools expands!