Avatar
omochimetaru 11/3/2022 8:24 PM
An exception to this rule is if a branch either returns, throws, or traps, in which case no value for the overall expression need be produced.
例外として、もし分岐がreturnやthrowsをしている場合は式の値を用意しなくて良い とあるんで、returnになってる分岐もアリみたいですね、かけそう。
8:25 PM
guard let foo = switch condition { case pattern: 0 ... default: nil } else { return } こう書いたほうがguardであることが表明できるけど、ちょっと行が増えちゃいますね (edited)