Array dimensions
This commit is contained in:
parent
b1838519f7
commit
de59d94e3b
1 changed files with 6 additions and 4 deletions
|
|
@ -5,8 +5,10 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
foo := [2][4][7]float64{}
|
||||
x := len(foo) // x == 2
|
||||
y := len(foo[0]) // y == 4
|
||||
z := len(foo[0][0]) // z == 8
|
||||
array := [12][4][7][10]float64{}
|
||||
x := len(array)
|
||||
y := len(array[0])
|
||||
z := len(array[0][0])
|
||||
w := len(array[0][0][0])
|
||||
fmt.Println("x:", x, "y:", y, "z:", z, "w:", w)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue