Hatena::Groupruby

mrのRuby学習帳 このページをアンテナに追加 RSSフィード

2009-09-26

arrayのconcatメソッド arrayのconcatメソッド - mrのRuby学習帳 を含むブックマーク

irb(main):001:0> a = [1,2,3]
=> [1, 2, 3]
irb(main):002:0> b = ["a","b","c"]
=> ["a", "b", "c"]
irb(main):003:0> a.concat
ArgumentError: wrong number of arguments (0 for 1)
        from (irb):3:in `concat'
        from (irb):3
irb(main):004:0> a.concat(b)
=> [1, 2, 3, "a", "b", "c"]
irb(main):005:0> p a
[1, 2, 3, "a", "b", "c"]
=> nil
irb(main):006:0>