- Custom Operators : prefix, postfix, infix 중 하나를 커스텀
infix operator *+* : MultiplicationPrecedence // 우선순위 그룹 설정
extension Int {
static func *+*(left: Int, right: Int) -> Int {
return (left * right) + (left * right)
}
}
1 *+* 2 + 3 // 7
- precedencegroup custom
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
Congratulations @gunw! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit