I wanted to add an approach to this exercise, is this something I can add a PR for?
If so:
Are there docs for this process?
I would like to use the 2nd iteration of my solution for this.
The differences with the existing approach are:
Using a (modern) switch statement
Avoiding the less than one check on the number by using a Range until number - 1 (which defaults to an empty range in case of a less than one number). This has a downside in performance.
Using the function in the Sum function to avoid using a separate Where.
My only concern is that this might be too much for a single approach in an easy exercise, or wouldn’t this be a problem?
This need not be a problem. Just explain everything that you feel requires explaining. There’s plenty of space.
If you really have a lot of material to explain, then be sure to organize it well so that the student can determine for themself which parts to read and which parts to skip.
I think second approach that uses a switch expression would make a lot of sense.
I think both changes should also be made to the existing approach, as they make the code easier to read (I would recommend though still starting the approach explanation with the current contents but adding some content to refactor to the above changes.
Do you mean first adding a PR for a second approach (switch) and then adding a PR refactoring the existing (if) approach using the Range and Sum refactorings?