gpt4 book ai didi

arrays - Ruby 中数组的问题

转载 作者:太空宇宙 更新时间:2023-11-03 16:14:02 26 4
gpt4 key购买 nike

<分区>

我创建一个数组并编辑值:

arr = Array.new(6, Array.new(2, '0'))
arr[0][0] = 'name'
arr[1][0] = 'id'
arr[2][0] = 'type'
arr[3][0] = 'sum'
arr[4][0] = 'partner'
arr[5][0] = 'time'

然后我有了这个数组:

[["time", "0"], ["time", "0"], ["time", "0"], ["time", "0"], ["time", "0"], ["time", "0"]]

当我需要这个时:

[["name", "0"], ["id", "0"], ["type", "0"], ["sum", "0"], ["partner", "0"], ["time", "0"]]

我做错了什么?

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com