equals
Table of Contents
Overview
The equals function takes two values and compares their values. If both values are the same, it returns a true, else it returns a false.
Return Type
Syntax
<variable> = <expression1>.equals(<expression2>);
where,
Parameter | Data type | Description |
<variable> | BOOLEAN | Variable which will contain the boolean result of the equals operation. |
<expression1> | ANY DATA TYPE | The value which needs to be compared. |
<expression2> | ANY DATA TYPE | The value which needs to be compared with the initial value. |
Note: The data type of both the parameters, <expression1> and <expression2> should match.
For example, say <expression1> is a TEXT datatype and <expression2> is a NUMBER datatype. In this case, the parameters won't match since they are of two different datatypes even if the same values are entered. Because of this mismatch, a false statement is returned.
For example, say <expression1> is a TEXT datatype and <expression2> is a NUMBER datatype. In this case, the parameters won't match since they are of two different datatypes even if the same values are entered. Because of this mismatch, a false statement is returned.
Examples
date_equals = '01/01/2017'.equals('01-Jan-2017'); // date_equals is assigned 'true' text_equals = "Zoho".equals("zoho"); // text_equals is assigned 'false'