mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-11 22:53:43 +08:00
add 7.0.md and 7.1.md
This commit is contained in:
14
eBook/examples/chapter_7/for_arrays.go
Normal file
14
eBook/examples/chapter_7/for_arrays.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package main
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
var arr1 [5]int
|
||||
|
||||
for i:=0; i < len(arr1); i++ {
|
||||
arr1[i] = i * 2
|
||||
}
|
||||
|
||||
for i:=0; i < len(arr1); i++ {
|
||||
fmt.Printf("Array at index %d is %d\n", i, arr1[i])
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user