Skip to content

Instantly share code, notes, and snippets.

@featherart
Last active December 24, 2015 04:39
Show Gist options
  • Save featherart/6745715 to your computer and use it in GitHub Desktop.
Save featherart/6745715 to your computer and use it in GitHub Desktop.
Some more practice with Arrays
# create an Array of 4 shoes
# iterate through your Array using each and {}'s
# and show a list of your shoes
# create an Array of 4 outfits using Array.new
# iterate through your outfits using a Range and do\end
# and print them out
# Shuffle each Array
# iterate through your Arrays and puts each outfit with each shoes
# using any form of iteration that floats your boat!
# A friend needs some shoes, so give her the last pair
# now you need a new pair, so push one in
# each outfit now needs to have "super duper" added to the front
# use a map to do this & make sure it stays that way
# each pair of shoes now needs a "!" after it
# do this using a map, but don't change the original Array
# Shuffle each Array again then print out a new
# set of outfits + shoes, mapping a "!!" on the end of each
# Create a big Array called wardrobe by adding your shoes and outfits
# iterate through your wardrobe & print the contents using each
# Spring cleaning! slice out 3 elements in the middle
# for donation. Verify wardrobe now contains 5 elements & donation 3
# You are fickle! Decide to keep donation items using push
# make sure you still just have a big Array and not an
# Array of Arrays
# print out each element in your wardrobe with a "OMFG!"
# added to the end of it, do this using each then with map
# You've joined a cult!
# permanently add "purple " to each item of your wardrobe
# Now use each to print out your new cultish wardrobe
# each pair of shoes now needs a "!" after it
# do this using a map, but don't change the original Array
# Shuffle each Array again then print out a new
# set of outfits + shoes, mapping a "!" on the end of each
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment