DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR SWIFT
let values = [3.0,6.0,9.0,1.0] let squares = values.map {$0 * $0} print(squares)
func sumSq(s: [Int]) -> Int { return s.map{$0 * $0}.reduce(0, +)}
Source by rosettacode.org #
PREVIOUS
NEXT
Tagged:
#values
#squares
ADD COMMENT
Topic
COMMENT
Name
3+1 =
Submit