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
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:
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:
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":
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:
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