SameSigns

Detect if two integers have opposite signs or not:

We have two numbers and we need to know if these numbers have the same signs or not without using the normal conditionals (if statements or switch) or loops.

We won't do that ❌

if number1 + number2 > 0 {
print("numbers have the same sign")
} else {
print("numbers don't have the same sign")
}

Given: 5, -6 Result: numbers don't have the same sign

Given: -5 , -2 Result: numbers have the same sign