# 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:** 361

<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:** [December 2, 2023, 9:15am UTC](https://forums.swift.org/t/pitch-multi-statement-if-switch-do-expressions/68443/361 "2023-12-02T09:15:07Z")

</div>

> [@wadetregaskis](#):
>
> It might be a challenge for the parser because of ambiguity with function calls…?

We were discussing the function call ambiguity aspect upthread: interestingly there's something in the compiler (if not in the grammar?) that prevents `()` or `[]` from being treated a function call / subscript if at least the opening `(` or `[` is not on the same line as the preceding expression, so that's no issue. We just haven't considered then the "compulsoriness" aspect (using `()` even if it's otherwise not needed to resolve the ambiguity, but as an "expression value" marker).

> [@wadetregaskis](#):
>
> I'm not sure it's intuitive, either. It looks like how ordered lists, or footnotes / references, are often written in text fields with limited formatting support, when used with integers.

Yes. It is meant to solve the issue often brought up against using the bare last expression - makes it easier to spot them.

BTW, if to use the last expression rule (bare or "dressed up") it is now obvious to me that it must _not_ be done in the multi statement functions/closures (e.g. for the sake of consistency). The reasoning is the same as the reasoning _not_ to use "return" to mean expression values. Whatever we choose, retuning a value from a function closure should be visually different to "expression statement" value (this is broken for the single-statement but let's not break it further in the multi-statement case). ["Option 5"](https://forums.swift.org/t/se-0380-if-and-switch-expressions/61899/77) rules.

---

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