# Enums with boolean raw values

**URL:** <https://forums.swift.org/t/enums-with-boolean-raw-values/69425>\
**Category:** Using Swift\
**Created:** [January 13, 2024, 10:53pm UTC](https://forums.swift.org/t/enums-with-boolean-raw-values/69425 "2024-01-13T22:53:19Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![tera](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/tera/32/38201_2.png) [@tera](https://forums.swift.org/u/tera)\
**Post date:** [January 14, 2024, 12:12pm UTC](https://forums.swift.org/t/enums-with-boolean-raw-values/69425/6 "2024-01-14T12:12:11Z")

</div>

Same bug as [this](https://github.com/apple/swift/issues/51889)?

I don't think it's right for EQ to compare rawValues instead of enumeration tags, we had a [thread](https://forums.swift.org/t/edge-case-enum/68181) on this recently. As a workaround I'd suggest to always override "==" when you adding RawRepresentable conformance, in this case:

```swift
    public static func == (lhs: Self, rhs: Self) -> Bool {
        switch (lhs, rhs) {
            case (.a, .a), (.b, .b): true
            case (.a, .b), (.b, .a): false
        }
    }

```

---

_[View the full topic](https://forums.swift.org/t/enums-with-boolean-raw-values/69425)._
