Skip to content

Instantly share code, notes, and snippets.

@joegiralt
Last active December 18, 2015 08:09
Show Gist options
  • Save joegiralt/5751992 to your computer and use it in GitHub Desktop.
Save joegiralt/5751992 to your computer and use it in GitHub Desktop.
homework
# Construct an array with your favorite foods. It should have at least 5 elements.
favorite_foods = ["Chicken tikka Masalla",
"Roasted Rabbit",
"Fried Ocra",
"Chanterelle Mushroom Soup",
"Pan Seared Skirt Steak"]
# Write a puts which returns your most favorite food out of the array.
puts favorite_foods[1]
# Construct an array with the colors of the rainbow (ROYGBIV)
prism = ["red",
"orange",
"yellow",
"green",
"blue",
"indigo",
"violet"]
# Slice the colors Red, Orange, and Yellow out of the array.
prism.slice(0..2)
# Create an empty array.
empty_array = []
# # Assign values to the the second and 6th position.
empty_array[1] & empty_array[6] = 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment