Day 4.5 Exercise 25 Even more Practice

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

Don’t quite enjoy this exercise. The sentence in exercise is horrible, due to sorted and unsorted, the first and last word still ends up in the same order. To top that confusion, the ending function makes it resets? So the result we see is All wait all who all wait all who.

To make it clear, instead of using words, try A B C D E F G.

Ex25 Module Code
Ex25 Module Code
Ex25 Run Code
Ex25 Run Code
Ex25 Run Code in Terminal
Ex25 Run Code in Terminal
Ex25 IRB
Ex25 IRB

Study Drill

1. Take the remaining lines of the What You Should See output and figure out what they are doing. Make sure you understand how you are running your functions in the ex25 module.
Done, to see my comments, please check out my GitHub (ex25a.rb).

2. The Ex25 module doesn’t have to be in a file name ex25.rb. Try putting it in a new file with a random name, then import that file and see how you still have Ex25 available even though the file you made does not have ex25 in it.
I renamed it, I’ve also tried renaming the module itself, it causes an error. Apparently, the name of the functions have to be the same as the module name. So Module Ex25, all your function will have to start with Ex25.

3. Try breaking your file and see what it looks like in irb when you use it. You will have to quit irb with quit() to be able to reload it.
Just typing quit is fine.


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s