# Evolution idea: implicit return in single-line switch cases

**URL:** <https://forums.swift.org/t/evolution-idea-implicit-return-in-single-line-switch-cases/59684>\
**Category:** Discussion\
**Tags:** swift-evolution, switch\
**Created:** [August 15, 2022, 10:31pm UTC](https://forums.swift.org/t/evolution-idea-implicit-return-in-single-line-switch-cases/59684 "2022-08-15T22:31:02Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![codename](https://avatars.discourse-cdn.com/v4/letter/c/fbc32d/32.png) [@codename](https://forums.swift.org/u/codename)\
**Post date:** [August 16, 2022, 3:14pm UTC](https://forums.swift.org/t/evolution-idea-implicit-return-in-single-line-switch-cases/59684/6 "2022-08-16T15:14:52Z")

</div>

This is something I have wished for ever since implicit returns were introduced.

However, I see it as purely a generalization of the current rules for implicit returns, to allow branching using control flow statements, rather than just treating control flow blocks as expressions universally.

IOW I’m not a huge fan of things like using a switch on the right hand of an assignment expression (`let result = switch value { … }`), but I do wish I could use implicit returns in control flow as a generalization of the current implicit return rules. 😀

[Note: I most often find myself wanting this when switching over `self` on an enum.]

```swift
enum Pet {
    case dog, cat, bird, other(String)

    var description: String {
        switch self {
            case .dog: "Dog"
            case .cat: "Cat"
            case .bird: "Bird"
            case .other(let petName): petName
    }
}

```

---

_[View the full topic](https://forums.swift.org/t/evolution-idea-implicit-return-in-single-line-switch-cases/59684)._
