laboratory/experiments/go/array-sum/README.md

386 B

Array Sum

This package contains functions to return the sum of all elements of a slice. There are three main functions which all return the same result but uses different methods. These are:

  • SumWithForLoop - Uses a for loop to calculate the sum.
  • SumWithRecursion - Uses recursion to calculate the sum.
  • SumWithTailRecursion - Uses tail recursion to to calculate the sum.