compareValues function

Compares two values