isequal( param1, param2 )


Parameters

  Type Description
param1 expression first value to compare
param2 expression second value to compare

_result

Set to a boolean value that specifies if param1 and param2 have the same values.

Descriptions

Compares both the root value and all array and property elements of param1 and param2. If param1 and param2 have the same root value, property values, and array values _result is set to true. If any values are different or if a property or array element exists on one parameter but not the other, _result is set to false. Isequal performs a deep comparison, meaning nested array and property elements are also compared. String comparisons are case sensitive. For case insensitive string comparisons, use the stricmp command.

In the example code below, the first call to isequal sets _result to false because the property names on the two variables are not the same (even though they have the same value). The second call to isequal sets _result to true because both variables have the same root value, property names, and property values.

var1 = 10
var1.prop1 = 20
var2 = 10
var2.prop2 = 20
isequal( var1, var2 )

var3 = 10
var3.prop3 = 20
var4 = 10
var4.prop3 = 20
isequal( var3, var4 )


If param1 and param2 have no property or array elements, the isequal command has the same behavior as the == operator. Since isequal is a command, it can not be used in an expression like operator == and must appear on a line by itself. After calling isequal, the _result variable may be used in an expression.

See Also

copy, assignment (=), initialize, clear, cleararray, countarray, setarraycount, clearprops, hasprop, countprops, getpropname, user variables