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.
 

23 lines
460 B

package main
import "fmt"
func compArrays() (bool, bool, bool) {
var arr1 [5]int
arr2 := [5]int{0}
arr3 := [...]int{0, 0, 0, 0, 0}
arr4 := [5]int{0, 0, 0, 0, 9}
return arr1 == arr2, arr1 == arr3, arr1 == arr4
}
func main() {
comp1, comp2, comp3 := compArrays()
fmt.Println("[5]int == [5]int{0} :", comp1)
fmt.Println("[5]int == [...]int{0, 0, 0, 0, 0}:", comp2)
fmt.Println("[5]int == [5]int{0, 0, 0, 0, 9} :", comp3)
}