Comparator function

bool comparator(string a, string b) {

if(a.size() <= b.size() && b.substr(0, a.size()) == a) return false;
else if(b.size <= a.size() && a.substr(0, b.substr()) == b) return true;
else a < b;

}

why we are return true and false in case of if and else if cases?
What does it mean?

@alter since we are using these compare function in sorting. so during sort we need to compare two element or charters to check that which should come before which.
these function tells us that the char which you want to place before other is true or not according to which sorting is done.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.