---
title: "==(_:_:)"
framework: swift
role: symbol
role_heading: Operator
path: "swift/optional/==(_:_:)-1j2c8"
---

# ==(_:_:)

Returns a Boolean value indicating whether the right-hand-side argument is nil.

## Declaration

```swift
static func == (lhs: _OptionalNilComparisonType, rhs: borrowing Wrapped?) -> Bool
```

## Parameters

- `lhs`: A nil literal.
- `rhs`: A value to compare to nil.

## Discussion

Discussion You can use this equal-to operator (==) to test whether an optional instance is nil even when the wrapped value’s type does not conform to the Equatable protocol. The following example declares the stream variable as an optional instance of a hypothetical DataStream type. Although DataStream is not an Equatable type, this operator allows checking whether stream is nil. var stream: DataStream? = nil if nil == stream {     print("No data stream is configured.") } // Prints "No data stream is configured."
