Skip to content

Instantly share code, notes, and snippets.

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