Even though these two operators are not see in day-to-day use (in programming world lah), but let’s see how to create  them in Swift 😁

import Cocoa

// Square root operator

prefix operator √

prefix func √(number: Double) -> Double {
    return sqrt(number)
}

print(√(9)) // 3.0
print(√(2)) // 1.4142135623731

// Plus-Minus operator

precedencegroup PlusMinusPrecedence {
    associativity: left
    higherThan: AdditionPrecedence
}

infix operator ±: PlusMinusPrecedence

func ±<T: BinaryInteger>(lhs: T, rhs: T) -> (T, T) {
    return (lhs + rhs, lhs - rhs)
}

print(1±2) // (2, 4)

prefix operator ±

prefix func ±<T: BinaryInteger>(number: T) -> (T, T) {
    return 0 ± number
}

print(±3) // (3, -3)