As was brought up several times upthread, quite many people consider return
should only return from closures / functions, but not be the value of if/switch/do expressions – because "it would be confusing otherwise". (Personally I won't see a problem of return returning from the "outer" function closure like in Rust, Ruby, Kotlin and Scala, but, again, many people consider that equally confusing, so we won't have that either.)
var isSuccess: Bool {
let x = switch self {
case .success: true
case .failure(err):
print("failure")
return false // THE CONFUSING PART
}
print("x")
return x
}