Compare Two Lists

Examples Filter
package main

import (
	"fmt"
)

func Equal(a, b []int) bool {
	if len(a) != len(b) {
		return false
	}
	for i, v := range a {
		if v != b[i] {
			return false
		}
	}
	return true
}

func main() {
	a := []int{1, 2, 3}
	b := []int{1, 2, 3, 4}
	c := []int{1, 2, 3}
	fmt.Println(Equal(a, b))
	fmt.Println(Equal(a, c))
}
Last Run  :
false
true