Exercises & activities from the go workshop provided by Packt: https://courses.packtpub.com/courses/go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
292 B

  1. package main
  2. import "fmt"
  3. func defineArray() [10]int {
  4. var arr [10]int
  5. return arr
  6. }
  7. func main() {
  8. fmt.Printf("%#v\n", defineArray())
  9. // Array with size set from initialization
  10. // []int would be result in a slice
  11. bla := [...]int{1, 2, 3, 4, 5}
  12. fmt.Printf("%#v\n", bla)
  13. }