该方法Array#*
采用整数:
thumbs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
thumbs = thumbs*2
#=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
如何将数组乘以任何浮点数而不仅仅是整数?例如,我希望得到以下结果:
thumbs = thumbs*1.5
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5]