Skip to content

Latest commit

 

History

History
 
 

day_2

Day 2 - Arrays and Iteration

Computers may not be smart, but they are good at processing things very quickly, like working through tons of data. To take full advantage, we need some way of storing lots of data. Today, you will learn about a Ruby data structure, the Array, that allows us to store collections of data. You will also learn about iteration: when you go through every element of an array.

When you are all done with the lessons, exercises, and questions for today, you will once again use git to save your work locally, and then send your work to Github.

Open your local copy of backend_mod_1_prework

Using your terminal, open your local copy of the forked repository you created during setup. To do this, you will need to use the terminal command cd to enter the directory that holds the repository. Once you are in the correct directory, use the terminal command atom . to open the prework repository. Revisit day_1 for more detail if needed.

Array and Iteration Lessons

  1. Work through the Arrays section of Ruby in 100 Minutes. As you work through this section, research each of the methods mentioned by looking through the Ruby docs for Arrays. Documentation like this might look intimidating, but diving in and practicing now will build your comfort level. Create a file in your day_2 directory called array_methods.md and describe what each method does in your own words.

  2. Work through the following lessons. Any files that you create while working can be kept in today's exercises directory.

  3. Work through the exercise files in the day_2/exercises directory. Complete them in this order:

    1. arrays
    2. iteration
  4. Answer the questions in the questions.md file in the day_2 directory.

Save your work in Git

When you finish all of the day_2 activities, enter the following commands in your terminal in order to save your work to your local git repository:

  1. $ git add day_2/exercises
  2. $ git add day_2/questions.md
  3. Use git add day_2/<filename> to add all additional files that you created today
  4. $ git status - you should see only green filenames - if you see any that are red, continue to git add those files until git status shows all green files.
  5. $ git commit -m "Add Day 2 Work"

Push to Github

Remember- You've saved your work to git on your local machine, but it is not yet accessible through your remote Github repository. Push your code up to Github with the following command:

git push origin master

You should now be able to log in to GitHub, navigate to your remote prework repository and see all the work you did today!