A Tour of Go Range continued
2014-10-27 02:27
309 查看
You can skip the index or value by assigning to
If you only want the index, drop the ", value" entirely.
_.
If you only want the index, drop the ", value" entirely.
package main import "fmt" func main() { pow := make([]int, 10) for i := range pow { pow[i] = i << uint(i) } for _, value := range pow { fmt.Printf("%d\n", value) } }
相关文章推荐
- A Tour of Go Range
- A Tour of Go Map literals continued
- A Tour of Go Variables with initializers
- A Tour of Go Slices
- A Tour of Go Channels
- A Tour of Go Numeric Constants
- A Tour of Go Slicing slices
- A Tour of Go Buffered Channels
- A Tour of Go Making slices
- A Tour of Go Interfaces
- Go踩坑之 time.Parse: month out of range
- A Tour of Go:开始!
- A Tour of Go Nil slices
- A Tour of Go Maps
- A Tour of Go Errors
- A Tour of Go Map literals
- A Tour of Go : Exercise: Loops and Functions
- A Tour of Go : Exercise: Maps
- A Tour of Go For
- A Tour of Go: Exercise: Rot13 Reader