Lesson 12 Activity 4

The Example solution shows a code string of “bug.y --;”. I have not seen that string before and I couldn’t find it in the toolbox.

I solved the problem with “bug.y=bug.y-5”

Please explain the difference.

Thank you,
Beth

Using “–” is shorthand for minus one. So when it is used in this activity, “bug.y–;” the bugs y position is decreased by 1 when the up arrow is pressed.

Thank you for that information. May I suggest that this gets added to the list of operators?

Beth

2 Likes

I had the same issue. If students are using blocks, when they drag the “sprite.y” block into the ‘if’ statement, it automatically adds in the =, so there is no way to do it as the example solution shows. This could be very frustrating to students. I don’t think my students are going to be able to figure this out.

There was recently a discussion here about the ++ operator which is the same thing. I believe they suggested we report it as a bug and they will clean up the Exemplars although ++ and – are great shortcuts once the kids know how to use them and are using code instead of blocks.

1 Like

I totally agree. I will have to emphasize it with my students, as I know some are still going to be a little uneasy about using the text vs. the blocks. Thanks!

1 Like

I glad this has been reported. I am working the problems and trying to stay ahead of what I am teaching the kids and I got stuck here on Lesson 12 puzzle 4. I had to look at the exemplars. I like how the ++ works. but wondering if that should be explained in the program.

Hey folks,

Just wanted to make sure you knew that the Code.org team was keeping an eye on this. ++ and – are parts of the JavaScript language and are indeed quite handy, but at least in the current version of the curriculum it’s not something we have curricular support for. We’ve marked this to get cleaned up. In general

sprite.x-- just means sprite.x = sprite.x - 1

so in exemplars that use ++ or – just make those changes and the code should work as expected.

Hope that helps!

2 Likes

Thanks so much for checking back. As I get more comfortable with the syntax behind the blocks I should be able to explain these details to the students better.

This is irrelevant to your question, but where can we find the The Example solution?

Hi @jchun, are you able to view the example solutions on the right side of the screen?
Just want to double check to see if you have a teacher account.

here is where you can find it:

Thanks for your response @kevinsukhoo , but I don’t see the example solutions on the right side of the screen. I am pretty sure I have a teacher’s account. If I click on the blue tab the red arrow is pointing at in the screenshot, I only see the list of my students. Can you help me locate the example solutions please?

@jchun it’s very likely that you don’t have a validated teacher account. If you click the announcement at the top of any unit (e.g. studio.code.org/s/csd3) you should be able to apply for your account.

Hoping this helps sort things out!

I do have a teacher’s account & I cannot see the solution