Ad
  • Custom User Avatar

    If we put the return statement inside the for loop, the for loop will only run once and therefor will not sum all the positive numbers, the return statement will exit the function immediately once it is encountered, and that's why we should place it outside the for loop so the for loop can run correctly al sum all the positive numbers.

  • Custom User Avatar

    May I ask why the return total is outside of the for loop? I had everything correct but that. Just need somebody to explain ty!!