Closed alex-ball closed 2 years ago
Thanks for catching this! I'm inclined to change it to total = total + number
and skip the additional explanation as this lesson often receives feedback that it runs long...
Thoughts?
As I say, +=
is a useful keystroke saver, but only once you are comfortable with what it does.
Considering both the cognitive load and timing issues, yes, I'd be quite happy to see the instances of it replaced with total = total + number
.
The solution to the "Cumulative Sum" challenge in Episode 12 uses the augmented assignment operator
+=
without comment or explanation. In the rest of the episode, the more verbosetotal = total + whatever
syntax is used. The only other occurrence of+=
is in Episode 18.My feeling is that
+=
is a useful shorthand but – given how similar it looks to comparisons like!=
,>=
,<=
– deserves a little explanation for anyone who hasn't seen it before. How about having a callout just before "Cumulative Sum" that explains it, then converting "Identifying Variable Name Errors" to use it as well? That would help with retaining it for Episode 18.Another solution would be to replace the instances in both episodes with the explicit, longer version, which would be less cognitive load but perhaps a bit of a shame.