Swift Functional Programming(Second Edition)
上QQ阅读APP看书,第一时间看更新

if

Swift provides if to define conditional statements. It executes a set of statements only if the condition statement is true. For instance, in the following example, the print statement will be executed because anEmptyString is empty:

var anEmptyString = "" 
if anEmptyString.isEmpty {
print("An empty String")
} else {
// String is not empty.
}