swift-book icon indicating copy to clipboard operation
swift-book copied to clipboard

Expression patterns can appear outside of switch case labels

Open AnthonyLatsis opened this issue 2 years ago • 0 comments

Location

https://docs.swift.org/swift-book/documentation/the-swift-programming-language/patterns#Expression-Pattern

Description

Expression patterns appear only in switch statement case labels.

This is not true. Expression patterns may appear in both switch case items and case conditions. For example, if case 0 = i {} or while case .function(let name, numParams: 0) = node {}.

rdar://46341816

AnthonyLatsis avatar Apr 17 '23 19:04 AnthonyLatsis