1.9.3-p286 :039 > (0...x.right.first.chem_species.size).each do |atom|
1.9.3-p286 :040 > puts x.right.first.chem_species[atom]
1.9.3-p286 :041?> end
H
2
O
1
=> 0...2
1.9.3-p286 :042 > x.right.first.chem_species[0]
=> ["H", 2]
1.9.3-p286 :043 >
不同的价值,为什么不卖出期权输出 ["H",2]
然后["O",1]
。 (作为第二种方法返回)。这似乎并不正确通过数组的数组迭代返回比预期
什么是'chem_species'类 - 它是一个哈希? – PinnyM 2013-02-17 04:35:39
x.right.first.chem_species.class - > Array – 2013-02-17 04:43:37