Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
test = Array.new test[0] = "foo"
工作正常
test[] = "foo"
返回错误。让数组自动生成索引的 Ruby 语法是什么?
test << "foo"
or
test.push("foo").
This format:
will append an element to an array as you're describing.