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.