1
a,b=1,2
=>[1,2]
a,b=[1,2]
=>[1,2]
我新受上红宝石,我有alchknowlege在蟒蟒那里也有这个特征约的a,b = 1,2或A,B = [1,2]上红宝石
什么剂量本feaure叫红宝石,也有我困惑的一件事
为什么在赋予a,b varient的值之后,输出一个数组?
a,b=1,2
=>[1,2]
a,b=[1,2]
=>[1,2]
我新受上红宝石,我有alchknowlege在蟒蟒那里也有这个特征约的a,b = 1,2或A,B = [1,2]上红宝石
什么剂量本feaure叫红宝石,也有我困惑的一件事
为什么在赋予a,b varient的值之后,输出一个数组?
两者都是相同的,试试这个在IRB:
a,b=1,2
a.kind_of? Integer --> True
b.kind_of? Integer --> True
a.kind_of? Array --> False
b.kind_of? Array --> False
puts a --> 1
puts b --> 2
a,b=[1,2]
a.kind_of? Integer --> True
b.kind_of? Integer --> True
a.kind_of? Array --> False
b.kind_of? Array --> False
puts a --> 1
puts b --> 2
Ruby docs是你最好的朋友+ IRB ofcourse。在那里有很多good tutorials,选择一个适合你。
很好的答案。你也可以通过参考一些书或教程来帮助提问者。 – Zabba 2010-11-03 06:26:18
已更新......... – zengr 2010-11-03 06:30:53