arr = [1, 2, 3] arr += [4] # => [1, 2, 3, 4] arr += [5, 6, 7] # => [1, 2, 3, 4, 5, 6, 7]
arr = [1, 2, 3] arr2 = arr + [4] # => [1, 2, 3, 4] arr2 = arr + [4, 5, 6] # => [1, 2, 3, 4, 5, 6]
+ の右側は要素が 1 つだけの場合も [] で囲む必要があります。
+
[]