!(_:)
Performs a logical NOT operation on a Boolean value.
Declaration
static func ! (a: Bool) -> BoolParameters
- a:
The Boolean value to negate.
Discussion
The logical NOT operator (!) inverts a Boolean value. If the value is true, the result of the operation is false; if the value is false, the result is true.
var printedMessage = false
if !printedMessage {
print("You look nice today!")
printedMessage = true
}
// Prints "You look nice today!"