Created
January 15, 2017 07:55
-
-
Save cipepser/f0ec9f7b3753cda59d84d05d2b631557 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"reflect" | |
) | |
func main() { | |
a := []int{1, 2, 3} | |
b := []int{2, 1, 3} // a != b | |
answer := reflect.DeepEqual(a, b) // 要素がひとつ異なる | |
fmt.Println(answer) // false | |
answer = reflect.DeepEqual(a, a) // 自分自身なので等しい | |
fmt.Println(answer) // true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment