EQUAL

The function EQUAL returns TRUE if the two values given as input are the same.

This function takes two values of any data type. It retunes a Boolean indicating whether or not the two values are equal: TRUE means that they are, FALSE means that they are not.

Declaration

EQUAL(val1, val2) -> bool

Parameters

val1 (type: any, required) A value of any data type.

val2 (type: any, required) A value of any data type.

Return Values

bool (type: Boolean) A Boolean indicating if val1 and val2 are the same. TRUE means that they are, FALSE means that they aren't.

Examples

The following example uses the EQUAL function to confirm that 1 is equal to 1:

EQUAL(1, 1) -> TRUE

The two values given for comparison do not have to be the same data type in order for EQUAL to run without throwing an error. For instance, the following example checks if the Number 1 is equal to the string "string". It isn't:

EQUAL(1, "string") -> FALSE

When comparing two values of different data types, the EQUAL function will always return FALSE, no matter how similar the two values are. For instance, the Number 2 is not equal to the string "2":

EQUAL(2, "2") -> FALSE

When comparing objects, the EQUAL function only returns TRUE if the two objects are identical in every way. For instance, If the two objects have the same properties, but one value is a character off, the EQUAL function will return FALSE:

EQUAL(
  {
    "first_name": "Jane",
    "last_name": "Doe",
    "full_name": "Jane Doe"
  },
  {
    "first_name": "Jane",
    "last_name": "Doe",
    "full_name": "Jane Doe2"
  }
) -> FALSE

Discussion

The EQUAL function serves the same purposes as the Equality (=) operator. Comparing two values with the EQUAL function will return the same result as comparing them with the Equality operator.

Last updated