Skip to content

Instantly share code, notes, and snippets.

@lucianoschillagi
Created October 30, 2024 15:52
Show Gist options
  • Save lucianoschillagi/f747af31a8fea9c13ec97ede245f9a89 to your computer and use it in GitHub Desktop.
Save lucianoschillagi/f747af31a8fea9c13ec97ede245f9a89 to your computer and use it in GitHub Desktop.
hash values for set types
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