mirror of
https://github.com/github/codeql.git
synced 2025-12-18 09:43:15 +01:00
These are currently added implicitly by the compiler in the context of `if`/`switch` expressions. In the future, there might be explicit `then <expr>` statement useful for cases where one would like to add more than one statement in the branch, to mark what value to actually use. See https://forums.swift.org/t/pitch-multi-statement-if-switch-do-expressions/68443
13 lines
138 B
Swift
13 lines
138 B
Swift
func a(_ x: Int) -> Int {
|
|
switch x {
|
|
case 0:
|
|
1
|
|
default:
|
|
0
|
|
}
|
|
}
|
|
|
|
func b(_ x: Int) -> Int {
|
|
if (x < 42) { 1 } else { 0 }
|
|
}
|