Skip to content

Instantly share code, notes, and snippets.

@tranhieutt
Created July 4, 2017 08:17
Show Gist options
  • Save tranhieutt/859ccb047baf1200234a79c119bf0915 to your computer and use it in GitHub Desktop.
Save tranhieutt/859ccb047baf1200234a79c119bf0915 to your computer and use it in GitHub Desktop.
[Swift] - reduce
let items = [2.0, 4.0, 6.0, 8.0]
let total = items.reduce(10.0,+)
//Console: 30.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment