[Swift]配列にreduceを使うサンプル

サンプルコード
let arr = [4, 5, 6, 7, 8]
let avg= arr.reduce(0) { $0 + $1 }
print(avg)

Swift

Posted by arkgame