Day 6.0 Exercise 34 Accessing Elements of Arrays

Here’s my work.
Here’s the link to exercise 34.

Ex34 Code
Ex34 Code
Ex34 Output
Ex34 Output

I know the author said use irb to test, however, I really dislike the irb, too much stuff being printed out. So instead of quizzing myself on irb, I’ll write the code and print it out.

Study Drill

1. With what you know of the difference between these types of numbers. Can you explain why the year 2010 in “January 1, 2010,” really is 2010 and not 2009? (Hint: You can’t pick years at random.)
The hint says can’t pick years at random. That means it’s ordinal number, it started at year 1. I have no clue. Humans reasoning can sometimes be illogical. Why don’t we start at 0?

2. Write some arrays and work out similar indexes until you can translate them.
I used the same arrays and translated in the comment sections. I just memorized Ordinal means ordered, does not start with 0, therefore no zeroth.

3. Use ruby to check answers.
Again, I dislike the irb, too much stuff printed out.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s