Tuesday, May 14, 2013

Ruby Lesson 1 Section 4 of 4 Review

Even though this is a review I learned something about methods. Originally I stated that we can have multiple methods on one line. While this is true Ruby will can have them on separate lines and it will have the same output.


Examples:

  1. Input: print "david".reverse.upcase

    Output: DIVAD
  2. Input: print "david".reverse
              .upcase

    Output: DIVAD
  3. Input: print "david"
              .reverse
              .upcase

    Output: DIVAD

Another thing that the review made me remember was that when setting variable as a number do not use quotation marks. 

So this is the end of the first lesson. Looking at my Accomplishment Time Log I'm being fairly consistent about my updates and that each of these posts are taking ~1hr. This is taking quite a bit longer than I had anticipated as when I had originally went through these lessons without making these posts it took me about 5-10 minutes to get through a section. I still think it's worth it because it is making me test things more, I have more questions and that forces me to look for answers. 

Overall, I think I'm not only understanding Ruby better, but also retaining more information by writing these posts. 

No comments:

Post a Comment