Change Up of Code Segments a bit confusions

In lesson 10, while walking students through defining the update score function, the student instructions say to use p1Score = p1Score + amt.

However, the teacher directions and the Practice Response (puzzle 25) use the code p1Score += amt

This was a bit confusing to the students who were paying close attention.

Either I missed it, or we didn’t talk about how the two codes “logic” are interchangeable.

If I missed this somewhere in Unit 5 and you remember where it is, please let me know.

Hi @mbrunner,

Hm, that is confusing. I’m not sure if that interchangeability is mentioned anywhere in the curriculum (I couldn’t find it anyway), but yes, x += 1 is shorthand for x = x +1. The shortest way to write this is x++ (only if incrementing by 1).

I’ll check with code.org staff, as this abrupt use of an untaught notation can definitely be confusing if it wasn’t taught previously.

Frank

1 Like