I needed to compare speeds in my game therefore I used an extension to declare the '>' and '<'symbols. My code is seen below:
extension CGVector {
var speed: CGFloat {
return hypot(dx, dy)
}
static func > (lhs: CGVector, rhs: CGVector) -> Bool {
return lhs.speed > rhs.speed
}
static func < (lhs: CGVector, rhs: CGVector) -> Bool {
return lhs.speed < rhs.speed
}
After some research I understood I should use the code above and it worked. However Im confused at a parts of the code. What does lhs and rhs stand for?
Thanks