[Solved] Can (a == 1 && a == 2 && a ==3) equal true? [closed]


you can overload == operator for Int type

extension Int {
    static func == (lhs: Int, rhs: Int) -> Bool
    {
        print("== overloading")
        return rhs > 0 && rhs < 4
    }
}

let a = 1;
if a == 1 && a == 2 && a == 3 {
    print("PASS"); //always will pass
}else{
    print("FAIL"); //will never execute
}

1

solved Can (a == 1 && a == 2 && a ==3) equal true? [closed]