📜  let values = [3.0,6.0,9.0,1.0] let squares = values.map {$0 * $0} print(squares) - Swift 代码示例

📅  最后修改于: 2022-03-11 15:00:59.755000             🧑  作者: Mango

代码示例2
func sumSq(s: [Int]) -> Int {  return s.map{$0 * $0}.reduce(0, +)}