Skip to content

Instantly share code, notes, and snippets.

@takopom
Created March 2, 2017 06:56
Show Gist options
  • Save takopom/0b47e5cc03df519965860432d34a0431 to your computer and use it in GitHub Desktop.
Save takopom/0b47e5cc03df519965860432d34a0431 to your computer and use it in GitHub Desktop.
Arrayの特定の区間の値を合計する
let sum = values[from..<to].reduce(0, +)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment