Files
learngo/14-arrays/06-compare-unnamed/main.go

36 lines
622 B
Go
Raw Normal View History

2018-11-15 16:37:09 +03:00
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package main
import "fmt"
// STORY:
// You want to compare two bookcases,
// whether they're equal or not.
func main() {
type (
bookcase [5]int
cabinet [5]int
)
blue := bookcase{6, 9, 3, 2, 1}
red := cabinet{6, 9, 3, 2, 1}
fmt.Print("Are they equal? ")
if cabinet(blue) == red {
fmt.Println("✅")
} else {
fmt.Println("❌")
}
fmt.Printf("blue: %#v\n", blue)
fmt.Printf("red : %#v\n", bookcase(red))
}