You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So this is a really dumb request but while reading I thought that ... (ellipsis) represented the size of the array in Line 2 below.
Given how there are three dots as well as three elements it would be better if we change the size so that confusion is avoided.
Not everyone knows what ellipsis are 😢
1.vara4 [4]int// An array of 4 ints, initialized to all 0.2.a3:= [...]int{3, 1, 5} // An array initialized with a fixed size of three**// elements, with values 3, 1, and 5.// Slices have dynamic size. Arrays and slices each have advantages// but use cases for slices are much more common.3.s3:= []int{4, 5, 9} // Compare to a3. No ellipsis here.4.s4:=make([]int, 4) // Allocates slice of 4 ints, initialized to all 0.5.vard2 [][]float64// Declaration only, nothing allocated here.6.bs:= []byte("a slice") // Type conversion syntax.
PROPOSED CAHNGES
1.vara4 [4]int// An array of 4 ints, initialized to all 0.2.a3:= [...]int{3, 1, 5, 7} // An array initialized with a fixed size of three** --CHANGED--// elements, with values 3, 1, and 5.// Slices have dynamic size. Arrays and slices each have advantages// but use cases for slices are much more common.3.s3:= []int{4, 5, 9, 7} // Compare to a3. No ellipsis here. --CHANGED--4.s4:=make([]int, 4) // Allocates slice of 4 ints, initialized to all 0.5.vard2 [][]float64// Declaration only, nothing allocated here.6.bs:= []byte("a slice") // Type conversion syntax.
The text was updated successfully, but these errors were encountered:
So this is a really dumb request but while reading I thought that
...
(ellipsis) represented the size of the array in Line 2 below.Given how there are three dots as well as three elements it would be better if we change the size so that confusion is avoided.
Not everyone knows what ellipsis are 😢
PROPOSED CAHNGES
The text was updated successfully, but these errors were encountered: