goext/langext/compare.go

33 lines
399 B
Go
Raw Permalink Normal View History

2022-10-27 16:00:57 +02:00
package langext
func CompareIntArr(arr1 []int, arr2 []int) bool {
for i := 0; i < len(arr1) || i < len(arr2); i++ {
if i < len(arr1) && i < len(arr2) {
if arr1[i] < arr2[i] {
return true
} else if arr1[i] > arr2[i] {
return false
} else {
continue
}
}
if i < len(arr1) {
return true
} else { // if i < len(arr2)
return false
}
}
return false
}