Last active
September 4, 2016 13:51
-
-
Save giigame/ca788a84b0efbd9bbc7829cd3b98ef39 to your computer and use it in GitHub Desktop.
var a = a や if let b = b {} のような紛らわしい構文も使えるswiftのシャドウイング ref: http://qiita.com/giigame/items/bdd7ab74ec8321b73b97
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
func foo(i: Int) { | |
var i = i | |
} |
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 i = 3 | |
do { | |
var i = i // Error: Variable used within its own initial value | |
} |
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 b: Int? = 3 | |
if let b = b { | |
print(b) // 3 | |
} | |
print(b) // Optional(3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment