Golang's range can iterate over maps and slices, but I was wondering if there is a way to iterate over a range of numbers, something like this
for i := range [1..10] {
fmt.Println(i)
}
or is there a way to represent range of integers in Go like how ruby does?
转载于:https://stackoverflow.com/questions/21950244/is-there-a-way-to-iterate-over-a-range-of-integers-in-golang