Question Algorithm Challenge Guide "Sum All Primes" Solution

Question Algorithm Challenge Guide "Sum All Primes" Solution
0

Hello!
Thank you for your time reading this.

After I solved the problem, I want to check other’s good solutions.
I have question after I read this solution.
First, I understood the logic of the solution.

  • Make function to check if the number is prime number-> if the num is prime number, it will add to the result. if not, i will not.

However, how the result sum up all the prime numbers?
I cannot find the code for adding up.

Please explain which point I am missing.
Thank you in advance.

Continuing the discussion from freeCodeCamp Algorithm Challenge Guide: Sum All Primes:

SumPrimes is “recursive,” meaning it calls itself repeatedly.In the return statement is where the summing happens - nonprimes simply pass the next iteration, while primes add themselves to a possibly deeply nested math expression.

Doesn’t seem it would be very efficient though.