O'Reilly logo

Learn Ruby the Hard Way: A Simple and Idiomatic Introduction to the Imaginative World of Computational Thinking with Code, Third Edition, Video Enhanced Edition by Zed A. Shaw

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exercise 25. Even More Practice

Image

We’re going to do some more practice involving functions and variables to make sure you know them well. This exercise should be straightforward for you to type in, break down, and understand.

However, this exercise is a little different. You won’t be running it. Instead, you will import it into Ruby and run the functions yourself.

ex25.rb

 1    module Ex25  2  3      # This function will break up words for us.  4      def Ex25.break_words(stuff)  5        words = stuff.split(' ')  6        return words  7      end  8  9      # Sorts the words. 10      def Ex25.sort_words(words) 11         ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required