누구나 foo
이 버전 1에서 변형 된 이유를 설명 할 수 있습니까? <<
과 =
과제의 차이점은 무엇입니까?<<와 =의 차이점
버전 1
foo = "apple"
bar = foo
"foo: #{foo}" # => foo: apple
bar << "hello"
"bar: #{bar}" # => bar: applehello
"foo: #{foo}" # => foo: applehello
버전 2
foo = "apple"
bar = foo
"foo: #{foo}" # => foo: apple
bar = bar + "hello"
"bar: #{bar}" # => bar: applehello
"foo: #{foo}" # => foo: apple
왜 downvote? 제발 코멘트 –
[문자열 연산자 사이의 차이 +와 루비의 <<] 중복 (http://stackoverflow.com/questions/15461966/difference-between-string-operators-and-in-ruby) –