Solution Review: Sum of Lists
Learn to build a recursive Dart function that sums integers in a list by understanding how to handle base and recursive cases. Gain skills to process lists backward and optimize function calls using recursion or ternary operators.
We'll cover the following...
We'll cover the following...
Task
In this challenge, you had to create a recursive function, sum, which sums together all the integers in a list.
Solution
A skeleton of the function was already provided for you. Let’s look it over.
int sum(List<int> numberList, int index) {
}
sum takes two parameters. The first is a list of type List<int> and the second is the index ...