Wednesday, September 2, 2015

Time to sort it all out...

  Hello, everyone!

  For the last couple of days I have not been able to get as much as studying done as I hoped, but I am done with first 10 chapters of Chris Pine's book. The chapter 10 exercise was the most challenging so far. I needed to write a script that asks the user for any number of words, gives all those words back in alphabetical order, preserving capitalization and keeping all the duplicates, and then shuffles all the words and gives them back in random order. The challenge of the exercise is that you cannot use any built in methods for it (like .sort). So I had to write the sorting script myself.

  The biggest challenge to me is to "solve" the exercise in English first, to figure out "how" I want the code to work. After I have an idea of how the code "should" work, writing it down in Ruby is just a matter of getting through all the error messages :)

  Here is how I solved it: Sorting Challenge

  I started working through Zed Shaw's Learn Ruby the Hard Way book, and I am up to chapter 15. The first 10 chapters were easy, but it is picking up difficulty fast.

  That's all for now!

-Andrei

No comments:

Post a Comment