infix operator *+* : MultiplicationPrecedence // 우선순위 그룹 설정
extension Int {
static func *+*(left: Int, right: Int) -> Int {
return (left * right) + (left * right)
}
}
1 *+* 2 + 3 // 7
precedencegroup MyPrecedence {
higherThan: AdditionPrecedence
}
infix operator *+* : MyPrecedence // 우선순위 그룹 설정
extension Int {
static func *+*(left: Int, right: Int) -> Int {
return (left * right) + (left * right)
}
}
1 *+* 2 + 3 // 7