作者:-1的人生 | 来源:互联网 | 2023-09-13 05:16
IsitpossibletoiterateoverarrayindicesinGolanguageandchoosenotallindicesbutthrowsom
Is it possible to iterate over array indices in Go language and choose not all indices but throw some period (1, 2, 3 for instance.
是否有可能在Go语言中迭代数组索引并且不是选择所有索引而是抛出一些句点(例如,1,2,3)。
For example,
例如,
for i, v := range array {
//do something with i,v
}
iterates over all indices in the array
迭代数组中的所有索引
What I want to know is there any chance to have something like that
我想知道的是有机会有类似的东西
for i:=1, v := range array {
//do something with i,v
i += 4
}
2 个解决方案