Section10-80

This commit is contained in:
2023-11-09 11:13:14 +01:00
parent 59ffa2443a
commit 40b6e50a16
2 changed files with 69 additions and 0 deletions

35
Section10/79.go Normal file
View File

@@ -0,0 +1,35 @@
package main
import "fmt"
func main() {
var n []int
fmt.Println(n == nil)
m := []int{}
fmt.Println(m == nil)
a, b := []int{1, 2, 3}, []int{1, 2, 3}
//fmt.Println(a == b)
var eq bool = true
a = nil
for i, valueA := range a {
if valueA != b[i] {
eq = false
break
}
}
if len(a) != len(b) {
eq = false
}
if eq {
fmt.Println("a and b slices are equal")
} else {
fmt.Println("a and b slices are not equal")
}
}