Why is the shovel operator (<<) preferred over plus-equals (+=) when building a string in Ruby?

后端 未结 7 953
一生所求
一生所求 2020-11-28 18:17

I am working through Ruby Koans.

The test_the_shovel_operator_modifies_the_original_string Koan in about_strings.rb includes the follo

相关标签:
7条回答
  • 2020-11-28 19:06

    Because it's faster / does not create a copy of the string <-> garbage collector does not need to run.

    0 讨论(0)
提交回复
热议问题