Skip to content

Instantly share code, notes, and snippets.

@hi-manshu
Created June 29, 2018 04:01
Show Gist options
  • Save hi-manshu/797e9ca85e364fc83b3b08120e93b2bc to your computer and use it in GitHub Desktop.
Save hi-manshu/797e9ca85e364fc83b3b08120e93b2bc to your computer and use it in GitHub Desktop.
variableName1 := [n]int{n1,n2,n3} // define an int array with n elements
variableName2 := [n]int{n1, n2, n3}
// define a int array with n elements, of which the first three are assigned.
//The rest of them use the default value 0.
variableName3 := [...]int{n4, n5, n6} // use `…` to replace the length parameter and Go will calculate it for you.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment