Caffeine-Powered Life

Ruby Koans

There’s a question in the string file.


# THINK ABOUT IT:

#

# Ruby programmers tend to favor the shovel operator (<<) over the

# plus equals operator (+=) when building up strings.  Why?

I was able to find the answer here. The += operator will create a new instance of a string. The << operator will append in place, as long as there’s enough room for the currently allocated string object.

Comments