December 2014
Beginner
336 pages
7h 41m
English
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 return words.sort 12 end 13 14 # Prints the first word after shifting it off. 15 ...
Read now
Unlock full access