compare

Compares to determine whether one number is greater than, equal to, or less than another number. For text strings, determines the alphabetical distance between words. Useful for sorting.

  • For numbers, if the first parameter is greater than the second parameter, it will output 1. If it’s lesser, it’ll output -1. If it’s equal, it’ll output 0. 
  • For strings, it will determine the alphabetical distance between the words. If the first letter is the same, it’ll compare the second letter, and so on down the line.

Examples

Numerical Parameters:

{compare(5,1)} = 1
{compare(5,5)} = 0
{compare(1,5)} = -1

Alphabetical Parameters:

{compare("a","z")} = -25
{compare("z","a")} = 25
{compare("aa","az")} = -25

Contact us

Top