Created
October 30, 2024 15:52
-
-
Save lucianoschillagi/f747af31a8fea9c13ec97ede245f9a89 to your computer and use it in GitHub Desktop.
hash values for set types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
let beatles: Set<String> = ["John", "Paul", "George", "Ringo"] // unique values - hash value | |
for member in beatles { | |
print("'Beatle \(member)' has a hash value →", member.hashValue) | |
} | |
print("The Beatles was →", beatles.count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment