Where is Ruby's string literal juxtaposition feature officially documented?

后端 未结 4 1631
小鲜肉
小鲜肉 2020-11-28 14:52

I recently realized that if you juxtapose a sequence of Ruby string literals (e.g. \'a\' \"b\" \'c\'), it\'s equivalent to the concatenation of those string lit

4条回答
  •  我在风中等你
    2020-11-28 15:09

    In addition to the pickaxe reference, there are some unit tests:

    # compile time string concatenation
    assert_equal("abcd", "ab" "cd")
    assert_equal("22aacd44", "#{22}aa" "cd#{44}")
    assert_equal("22aacd445566", "#{22}aa" "cd#{44}" "55" "#{66}")
    

提交回复
热议问题