Created
July 20, 2016 09:02
-
-
Save niwatako/7a413a216cc7894c20954c633d16a53c to your computer and use it in GitHub Desktop.
string2 が nil の時に print("load") が実行されてほしいのです https://twitter.com/rizumita/status/755687567933120513 #CodePiece
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let string1 = "" // これが isEmpty なら | |
let string2: String? = nil // nil の時でも | |
if let s = string2 where s == "string" || string1.isEmpty { | |
print("load") // 実行されたい | |
} | |
// こんな書き方はできないけどイメージはこれ if (let where ) || ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment