*文字列の結合 [#s1007e8d] **Python [#zac7c88d] ~+で結合。*で繰り返しになる。 >>> word = 'Help' + 'A' >>> word 'HelpA' >>> '<' + word*5 + '>' '<HelpAHelpAHelpAHelpAHelpA>' 隣り合ったリテラル文字列は自動的に結合される。 >>> 'str' 'ing' # <- これは ok 'string' >>> 'str'.strip() + 'ing' # <- これは ok 'string' >>> 'str'.strip() 'ing' # <- これはダメ File "<stdin>", line 1, in ? 'str'.strip() 'ing' ^ SyntaxError: invalid syntax **Ruby [#kb79f520] ~+を使う。 s = "Hello " t = s + "World" ~<<を使う。 s = "Hello " s << "World" concatを使う。 s = "Hello " s.concat("World") ~<<やconcatを使うと、中身が変わるので注意。以下のコード参照 a = "AAA" b = a a << "BBB" puts b #=>AAABBB