Sometimes it's hard to keep up with your Netflix movie queue. Sometimes, all you need is a Friday night to binge watch Scandal.
We're going to use arrays to manipulate our own movie Queue.
Open this lab in Nitrous. Run learn
in terminal to run the Rspec tests. Use those tests as guidance to code your solution in movies.rb
.
###Step 1:
Define a method first_movie
that returns the first movie in the queue. This method should accept an array as an argument (the movie queue)
####Step 2:
Define a method watch_movie
that deletes the first movie in the array and returns the modified array. This method should accept an array as an argument (the movie queue).
####Step 3:
Define a method update_queue
that returns the updated array. This method takes two arguments (the array of movies and the movie you want to add to the queue).
####Step 4:
Define a method view_queue
that uses the each method to iterate over the array of movies. This method should use puts to print out "You will watch [movie name]" for every movie in the list. This method should accept an array as an argument (the movie queue).
View Netflix Movie Queue on Learn.co and start learning to code for free.