mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
35 lines
434 B
Plaintext
35 lines
434 B
Plaintext
func foo(idxOpt: Int?) {
|
|
guard let idx = idxOpt else {
|
|
return
|
|
}
|
|
print(idx)
|
|
}
|
|
|
|
func bar(fooOpt: Int?) {
|
|
if let foo = fooOpt {
|
|
let incrementedFoo = foo + 1
|
|
print(incrementedFoo)
|
|
}
|
|
}
|
|
|
|
func fooBar(fooOpt: Int?) {
|
|
if let foo = fooOpt {
|
|
let incrementedFoo = foo + 1
|
|
print(incrementedFoo)
|
|
print(foo)
|
|
}
|
|
}
|
|
|
|
func barFoo(idxOpt: Int?) {
|
|
if let idx = idxOpt {
|
|
print(idx)
|
|
} else {
|
|
print("nil")
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|