mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
22 lines
403 B
Swift
22 lines
403 B
Swift
// RUN: %swift -i %s | FileCheck %s
|
|
// REQUIRES: swift_interpreter
|
|
|
|
var x : @unchecked Int? = .None
|
|
if x {
|
|
println("x is non-empty!")
|
|
}
|
|
else {
|
|
println("an empty optional is logically false")
|
|
}
|
|
// CHECK: an empty optional is logically false
|
|
|
|
x = .Some(0)
|
|
|
|
if x {
|
|
println("a non-empty optional is logically true")
|
|
}
|
|
else {
|
|
println("x is empty!")
|
|
}
|
|
// CHECK: a non-empty optional is logically true
|