# SE-0380: \`if\` and \`switch\` expressions

**URL:** <https://forums.swift.org/t/se-0380-if-and-switch-expressions/61899>\
**Category:** Proposal Reviews\
**Created:** [December 7, 2022, 5:47pm UTC](https://forums.swift.org/t/se-0380-if-and-switch-expressions/61899 "2022-12-07T17:47:41Z")\
**Posts on this page:** 1\
**Showing post:** 55

<div class="post-metadata">

**Author:** ![ben-cohen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ben-cohen/32/296_2.png) [@ben-cohen](https://forums.swift.org/u/ben-cohen)\
**Post date:** [December 12, 2022, 7:58pm UTC](https://forums.swift.org/t/se-0380-if-and-switch-expressions/61899/55 "2022-12-12T19:58:10Z")

</div>

> [@Paul\_Cantrell](#):
>
> There’s no precedent for that rule in other imperative languages that support conditional expressions.

Thanks for doing the analysis. I was actually teetering on the brink of agreeing maybe allowing `return` wasn't such a good idea and we could drop that part – and this post pulled me back to thinking it's a good idea.

Another reason is, there's a particular form in Swift that would benefit from `return`... failable initializers. Which are often of the form "either assign something to `self`, or return `nil` from this function", e.g.

```swift
    init?(rawValue: String) {
        self = switch rawValue {
        case "foo": 1
        case "bar": 2
        case "baz": 3
        default: return nil
        }
    }

```

It'd be a shame to require them to lose the benefit of this proposal.

---

_[View the full topic](https://forums.swift.org/t/se-0380-if-and-switch-expressions/61899)._
