Day 3.3 Exercise 15 Reading Files

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

Ex15 Code
Ex15 Code
Ex15 Shell
Ex15 Output

Study Drill

1. Above each line, write out in English what that line does.
Done.

2. If you are not sure ask someone for help or search online. Many times searching for “ruby Thing” will find answers to what that Thing does in ruby. Try searching for “ruby open”.
Done.

3. I used the word “commands” here, but commands are also called “functions” and “methods”. You will learn about functions and methods later in the book.
Okay.

4. Get rid of lines 8-13 where you use gets.chomp and run the script again.
Done.

5. Use only gets.chomp and try the script that way. Why is one way of getting the filename better than another?
They both does the same thing, I’m not sure why? Same amount of lines of codes. But I like gets.chomp better, just the ARGV requires input prior to starting the program, while gets.chomp reminds you to type it in.

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