1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| type Product struct { name, category string price float64 upc int64 }
func main() { arr := [0]int{} println(len(arr) == 0) slice := make([]int, 0, 0) println(len(slice) == 0)
str := "123" println(str == "0" || str == "")
var prd Product var prdPtr *Product println(prd.name == "" && prd.category == "" && prd.price == 0 && prd.upc == 0) println(prdPtr == nil) }
|