Last active
August 29, 2015 14:03
-
-
Save rizumita/a1eedd66d0dd20d179b7 to your computer and use it in GitHub Desktop.
Swiftのif letでは二つ以上の変数を同時に束縛できないのでその代替方法 ref: http://qiita.com/rizumita/items/14f92c540039af16b7a5
This file contains 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 first : Int? = "1".toInt() | |
let second : Int? = "2".toInt() | |
switch (first, second) { | |
case (.Some(let f), .Some(let s)): | |
println(f + s) | |
default: | |
println("error") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment