Why is the apple’s position 90 in the Unit 3 assessment? How can I explain this to my students.
Consider the following program (blocks and text)
What is the apple’s x position at the end of this program?
Why is the apple’s position 90 in the Unit 3 assessment? How can I explain this to my students.
Consider the following program (blocks and text)
What is the apple’s x position at the end of this program?
Hi dlgleason,
Even though the apple’s position is initially 20, it is then updated by the value of the banana
, which is 60 and then added 30, giving you the resulting value of 90.
By the way, welcome to our community!
If they thought it was 100, the explanation would be that the computer does the computation line by line. When it gets to line 3 it replaces apple.x with the current value of banana.x, which is 60, +30. It does not look ahead to the final value of banana.x in line 4.