Comparator that we use in sort function

When we make a comparator for the sorting function, should the function always return a boolean value

While sorting, we are always comparing two elements. So in comparision , either two elements can be equal or less-greater. Hence a boolean is returned denoting less or greater in inbuilt-sort function.