# Is there a way to check if an enum is a specific case without switching on it?

**URL:** <https://forums.swift.org/t/is-there-a-way-to-check-if-an-enum-is-a-specific-case-without-switching-on-it/24012>\
**Category:** Using Swift\
**Tags:** enums\
**Created:** [May 1, 2019, 3:26pm UTC](https://forums.swift.org/t/is-there-a-way-to-check-if-an-enum-is-a-specific-case-without-switching-on-it/24012 "2019-05-01T15:26:02Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![suyashsrijan](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/suyashsrijan/32/5292_2.png) [@suyashsrijan](https://forums.swift.org/u/suyashsrijan)\
**Post date:** [May 1, 2019, 3:39pm UTC](https://forums.swift.org/t/is-there-a-way-to-check-if-an-enum-is-a-specific-case-without-switching-on-it/24012/6 "2019-05-01T15:39:25Z")

</div>

If you want to check for a case, that's not gonna work

```swift
let some: Swift.Result<Int, Error> = .success(0)
XCTAssertEqual(some, .success(_)) // error
XCTAssertEqual(some, Swift.Result<Int, Error>.success(_)) // error

```

I wrote a pitch on it a while ago: [Comparing enums without their associated values](https://forums.swift.org/t/comparing-enums-without-their-associated-values/18944)

I just need to find some time to figure out the best way to do it.

---

_[View the full topic](https://forums.swift.org/t/is-there-a-way-to-check-if-an-enum-is-a-specific-case-without-switching-on-it/24012)._
