---
title: "!(_:)"
framework: swift
role: symbol
role_heading: Operator
path: "swift/bool/!(_:)"
---

# !(_:)

Performs a logical NOT operation on a Boolean value.

## Declaration

```swift
static func ! (a: Bool) -> Bool
```

## Parameters

- `a`: The Boolean value to negate.

## Discussion

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!"

## See Also

### Transforming a Boolean

- [toggle()](swift/bool/toggle().md)
- [||(_:_:)](swift/bool/__(_:_:).md)
- [&&(_:_:)](swift/bool/&&(_:_:).md)
