开发者

Add a hash to an array?

I've currently got this hash:

{:residential=>"fal开发者_运维技巧se"}

But I need to make it an item of an array:

[{:residential=>"false"}]

How do I do that?


my_array = []
my_array << {:residential => "false"}
=> [{:residential=>"false"}]


The code you've already written should be just fine.

>> x = [{:residental=>"false"}, {:residental=>"true"}]                  
=> [{:residental=>"false"}, {:residental=>"true"}]                      
>> x[0][:residental]                                                    
=> "false"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜