How to check if two integers have opposite signs in Swift

1 Answer

0 votes
import Foundation

var x = 3
var y = -9
var b = (x ^ y) < 0
print(b)

x = 5
y = 6
b = (x ^ y) < 0
print(b)



/*
run:

true
false

*/

 



answered Jul 24, 2025 by avibootz

Related questions

...