identical(X;Y)

Returns a boolean value indicating whether the two arguments are identical. (Available as of version 11.21)

Syntax

identical(X;Y)

Input

Argument Type Description
X any The value to compare to Y
Y any The value to compare to X

Return Value

Returns a boolean value indicating whether X and Y are identical. X and Y can be any type, including special values. Special types (lists, packages, etc.) are compared component to component.

Although X and Y can be different types, values of different types are never identical. This function provides a stricter comparison than same(X;Y) by treating scalars of different underlying type as different. (This is also true for packages with their keys in different order.) See same(X;Y) for more information on that function.

Note: The use of this function is not typically desired, however, because block code itself converts freely between numbers and their string representation.

Example

The following example demonstrates the behavior of identical(X;Y) given inputs of various types.
Note: The <transpose> and <col> operations at the end of the query are only used to display the results in a more readable manner for this example and are not germane to the identical(X;Y) function in any way.
<table/>
<let one_list="{lst('1' '2' '3')}" 
     two_list="{lst('1' '2' '3')}" 
     three_list="{lst('3' '2' '1')}" 
     four_list="{lst('4' '5' '6')}">
  <willbe name="identical_lst" 
   value="identical('{@one_list}';'{@two_list}')"/>
  <willbe name="not_identical_lst" 
   value="identical('{@one_list}';'{@three_list}')"/>
  <willbe name="also_not_identical_lst" 
   value="identical('{@one_list}';'{@four_list}')"/>  
  <willbe name="identical_strings" 
   value="identical('foo';'foo')"/>
  <willbe name="not_identical_strings" 
   value="identical('foo';'bar')"/>
  <willbe name="identical_integers" 
   value="identical(25;25)"/>
  <willbe name="not_identical_integers" 
   value="identical(25;50)"/>
  <willbe name="not_identical_numeric_values" 
   value="identical(25;25.0)"/>
  <willbe name="also_not_identical_numeric_values" 
   value="identical(25.0;25.01)"/>
  <willbe name="not_identical_different_types" 
   value="identical(1;'1')"/>
  <willbe name="also_not_identical_different_types" 
   value="identical(1;'2')"/>  
  <transpose namecol="test"/>
  <col name="test" format="width:35"/>
</let>