Last active
October 4, 2015 14:39
-
-
Save naoyashiga/7917ccd4810ccc1fa52e to your computer and use it in GitHub Desktop.
[Swift]省略記法で$0.0と$0.1を使う例 ref: http://qiita.com/naoyashiga/items/4f06692c2c9a652f36ba
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 array = ["カレー","ラーメン","ハンバーグ"] | |
array.enumerate().forEach { (index, element) in | |
print("index:\(index) element:\(element)") | |
} | |
//省略記法 | |
array.enumerate().forEach { | |
print("index:\($0.0) element:\($0.1)") | |
} |
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
index:0 element:カレー | |
index:1 element:ラーメン | |
index:2 element:ハンバーグ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment