# Pitch: Multi-statement if/switch/do expressions

**URL:** <https://forums.swift.org/t/pitch-multi-statement-if-switch-do-expressions/68443>\
**Category:** Pitches\
**Created:** [November 14, 2023, 1:07am UTC](https://forums.swift.org/t/pitch-multi-statement-if-switch-do-expressions/68443 "2023-11-14T01:07:11Z")\
**Posts on this page:** 1\
**Showing post:** 287

<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:** [November 28, 2023, 5:25am UTC](https://forums.swift.org/t/pitch-multi-statement-if-switch-do-expressions/68443/287 "2023-11-28T05:25:39Z")

</div>

> [@Jon\_Shier](#):
>
> So I guess the question is, are if / switch expressions more like functions / closures or more like their statement counterparts?

Obviously if/switch expressions are more like statements than functions/closures:

- no "in"
- no closure / capture list
- can't assign the "uncalled form" to a variable, pass that variable around and call that variable later on
- can't have a return (at least in a "single statement" if expression) while there is no problem of having "return" in a single statement function/closure.)
- no "non trailing closure" form:

```swift
    let x = if (true, then: {1}) // 🛑
    let x = if (true, then: {1}, else: {2}) // 🛑

```

> [@Jon\_Shier](#):
>
> But returning _through_ expressions is exactly what was initially proposed in SE-380 and was discarded precisely because it _is_ confusing

Thanks for the reminder! Reviewing that thread I found that using "return" to mean "expression value" was also regarded as confusing (see discussion for Option #1 linked below).

[This](https://forums.swift.org/t/se-0380-if-and-switch-expressions/61899/45), [this](https://forums.swift.org/t/se-0380-if-and-switch-expressions/61899/77) and [this](https://forums.swift.org/t/se-0380-if-and-switch-expressions/61899/90) post are particularly interesting. As a compromise solution I like (Option #5), makes sense (bare last expression in if/switch statements, explicit return in functions/closures).

---

_[View the full topic](https://forums.swift.org/t/pitch-multi-statement-if-switch-do-expressions/68443)._
