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

# isEqual(to:)

Returns a Boolean value that indicates whether the number object’s value and a given number are equal.

## Declaration

```swift
func isEqual(to number: NSNumber) -> Bool
```

## Parameters

- `number`: The number to compare to the number object’s value.

## Return Value

Return Value true if the number object’s value and number are equal, otherwise false.

## Discussion

Discussion Two NSNumber objects are considered equal if they have the same id values or if they have equivalent values (as determined by the compare(_:) method). This method is more efficient than compare(_:) if you know the two objects are numbers.

## See Also

### Comparing NSNumber Objects

- [compare(_:)](foundation/nsnumber/compare(_:).md)
