Skip to content

Instantly share code, notes, and snippets.

@giigame
Last active September 4, 2016 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giigame/ca788a84b0efbd9bbc7829cd3b98ef39 to your computer and use it in GitHub Desktop.
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
func foo(i: Int) {
var i = i
}
let i = 3
do {
var i = i // Error: Variable used within its own initial value
}
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