Created
August 23, 2015 20:41
-
-
Save eternal44/4c86061d6d21120f6b5a to your computer and use it in GitHub Desktop.
Comparing "each_line" with "collect"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def split_message(message) | |
output_line = "" | |
message.each_line.with_index(1) do |line, index| | |
output_line << "Line #{index}: #{line}" | |
end | |
output_line | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment