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.

22 lines
430 B

  1. package main
  2. import "fmt"
  3. func compArrays() (bool, bool, [10]int) {
  4. var arr1 [10]int
  5. arr2 := [...]int{9: 0}
  6. arr3 := [10]int{1, 9: 10, 4: 5}
  7. return arr1 == arr2, arr1 == arr3, arr3
  8. }
  9. func main() {
  10. comp1, comp2, arr3 := compArrays()
  11. fmt.Println("[10]int == [...]int{9: 0} :", comp1)
  12. fmt.Println("[10]int == [10]int{1, 9: 10, 4: 5}:", comp2)
  13. fmt.Println("arr3 :", arr3)
  14. }