---
title: "isEqual(to:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsdata/isequal(to:)"
---

# isEqual(to:)

Returns a Boolean value indicating whether this data object is the same as another.

## Declaration

```swift
func isEqual(to other: Data) -> Bool
```

## Parameters

- `other`: The data object with which to compare the receiver.

## Return Value

Return Value true if the contents of otherData are equal to the contents of the receiver, otherwise false.

## Discussion

Discussion Two data objects are equal if they hold the same number of bytes, and if the bytes at the same position in the objects are the same.

## See Also

### Testing Data

- [length](foundation/nsdata/length.md)
