mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
23 lines
350 B
Plaintext
23 lines
350 B
Plaintext
func testCollapseNestedIf() {
|
|
let a = 3
|
|
if a > 2 {
|
|
if a < 10 {}
|
|
}
|
|
}
|
|
func testMultiConditionalNestedIf() {
|
|
let a = 3
|
|
if a > 2, a != 4 {
|
|
if a < 10, a != 5 {}
|
|
}
|
|
}
|
|
func testLetNestedIf() {
|
|
let a: Int? = 3
|
|
if let b = a, b != 5 {}
|
|
}
|
|
func testCaseLetNestedIf() {
|
|
let a: Int? = 3
|
|
if case .some(let b) = a {
|
|
if b != 5 {}
|
|
}
|
|
}
|