Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Comparing arrays in Golang
package main
import (
"fmt"
)
func main() {
/* Shorthand declaration */
scores := [4]int{80, 85, 45, 55}
herScores := [...]int{80, 85, 45, 55}
hisScores := [4]int{80, 45, 22, 33}
fmt.Println(scores == herScores) /* Returns truee */
fmt.Println(scores == hisScores) /* Returns false */
fmt.Println(herScores == hisScores) /* Returns false */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.