Equatable

#equatable

Overview

Sample Codes

Example 1
func getRandomNumber() -> some Equatable {  // It will be Equitable but some specific kind of
    Double.random(in: 1...6)  // Here it says the Equatable is Integer, thus it gives us the ability to change our mind later
}

func getRandomBool() -> some Equatable {
    Bool.random()
}

print(getRandomNumber() == getRandomNumber())

// print: false

Sources

Videos

Articles / Documents

Last updated