0
我是Ruby的新手,我试图通过传递两个值作为高度,另一个作为宽度来创建实质上的图表。创建后,我希望能够单独调用图上的每个点。我知道我需要创建一个散列和或数组来存储图上的每个点,但我不知道如何迭代每个值。红宝石 - 如何创建绘图点
例如
def graph_area(x, y)
x = 4
y = 2
# Given the above info my graph would have 8 points
# However I'm not sure how to make create an array that returns
# {[x1, y1] => 1, [x1, y2] => 2, [x2, y1] => 3, [x2, y2]...} etc
# output
# 1234
# 5678
end
是这种方法,即使是一个实践?