I have just been studying the concept of recursion and I thought that I would try a simple example. In the following code, I am attempting to take the numbers: 1, 2, 3, 4, 5, an
static int Sum(int[] addends) { if (addends.Length == 1) { return addends[0]; } else { int tailIndex = addends.Length - 1; var subArray = addends[0..tailIndex]; return addends[tailIndex] + Sum(subArray); } }