Forum: Ruby Strange argument error in Ruby 1.8.4 (2006-02-24)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Nicolas P. (Guest)
on 2006-03-10 11:39
(Received via mailing list)
Hi there,

I found a strange difference somewhere between Ruby 1.8.4 (2005-12-24)
and Ruby 1.8.4 (2006-02-24).

Here the code:

h = {}
a = []
h['test'] ||= a.join 'c'

ArgumentError: wrong number of arguments (2 for 1)
        from (irb):5:in `[]'
        from (irb):5


To fix it, I add parenthesis like that:

h['test'] ||= a.join('c')

But I found it strange enough to ask the question.

Regards,
This topic is locked and can not be replied to.