Skip to content

Glossary: Data Structures and Algorithms in Go

cmp.Compare

Also written: cmp package, strings.Compare

A function from Go's `cmp` package that compares two numbers or strings and returns negative, 0 or positive. It is the usual building block of a comparison function.

Where the book teaches it

Related terms

Comparison functionslices.SortFunc