use ( ! ) to flip the value of a boolean variable.
i.e
var istrue: Bool = true !istrue
output
false
using variable inside strings
var istrue: Bool = false istrue = !istrue print("the value of istrue variable is \(istrue)")