Last active
March 1, 2020 19:58
-
-
Save rcoproc/cc11f38a28da59f77f0956bedda7d90b to your computer and use it in GitHub Desktop.
Multi Dimensional array with for range navigation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
a := [...][2]int{{1, 2}, {3, 4}, {5, 6}} | |
fmt.Printf("Array is %v and type of array element is %T", a, a[0]) | |
fmt.Println("") | |
for parent, child := range a { | |
for _, item := range child { | |
fmt.Printf("Item %d of Array %d\n", item, parent) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment