Created
January 9, 2015 09:43
-
-
Save el-hoshino/58f467d53787bf18c402 to your computer and use it in GitHub Desktop.
配列宣言時型推論の意外な落とし穴 ref: http://qiita.com/lovee/items/7e96284f4520b48646a3
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 testString = "test" | |
let testFlag = true | |
let testInt = 1 | |
let testArray = [testString, testFlag, testInt] |
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 testAny = testArray[0] as Any |
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 testArray: [Any] = [testString, testFlag, testInt] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment