In Swift, the hashValue
method returns the hash value of a double.
A hash value, or a hash, is a unique value that differentiates an object’s value from others.
Note: Hash values are not the same for every execution of our program.
doubleValue.hashValue
doubleValue
: This is the double value whose hash value we want.This method returns the hash value of the double value.
// Create some double valueslet d1 = 12.44let d2 = 1.23333let d3 = 100.1let d4 = 1.0// Print the exponentsprint(d1.hashValue)print(d2.hashValue)print(d3.hashValue)print(d4.hashValue)