When are two values or objects equal or identical?

Whether two values are equal or not can be decided by the == operator, for example, 5 == 5 and 5 == 5.0 are both true. Equivalent to this operator is the isequal() function:

isequal(5, 5)   #> true 
isequal(5, 5.0) #> true 

Both the preceding statements return true, because objects such as numbers are immutable and they are compared at the bits level.

To see whether the two objects x and y are identical, they must be compared with the === operator. The result is a Bool value, true or false: x === y -> Bool, for example:

5 === 5 #> true 5 === 5.0 #> false

For objects that are more complex, such as strings, arrays, or objects that are constructed from composite types, the addresses in the memory ...

Get Julia 1.0 Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.