CSD Lesson 13. Code stop line 8 - Type error_

I can’t figure out why it gives a type error on line 8 as that code was already provided.
So I can’t see if what I’m doing is correct (which very well may not be).

What I think I want to say is:
If mouse click down
var_click = var_click + 1

If this is correct how do I put the second var_click in?


Hi @glen.strickland,

For troubleshooting & debugging issues, it helps the moderation team if you can provide the info with the template on the debugging page:

  1. Link to your project: click the “Share” button at the top of the page and paste the link it produces into your post.
  2. Are there any particular steps that cause the error?
  3. What did you expect the program to do?
  4. What did it do instead?

That said, there’s two possible errors I can see:

  • The pseudocode you typed above says “mouse click down” – there’s a different event name in Game Lab. Check that everything matches exactly, including spacing and capitalization.
  • If you want to use the structure “variable = variable + 1;” you’ll need to use one of the blocks in the Math drawer to make that work:

There are also example solutions if you expand the teacher menu on the right side of the screen:


Hope that helps,
–Michael K.

I’m just getting used to using the forum and I appreciate your patience. Part of my learning process is putting a screenshot in messages.
The example code does not appear when I expand the menu on the right.

@glen.strickland … Hmmm … not sure why the answer keys don’t show up in your teacher panel. I might try logging out and then logging in again to see if that solves it. If not, you could send a message to support@code.org and see if they can help troubleshoot that one.

I took a look at your code and it looks like you have it mostly correct, all but one thing. On line 11 (inside the if block), you are using the same block as you are using on line 1 to declare the variable ‘clicks’. In programming you only declare it one time. The block you use to declare it starts with “var”. Then, later in your programming, you only need to refer to it by name (no var in front). So you will want to look for the variables block that doesn’t start with var… (x = __). Then, change the x to the variable name and put your counting formula in the other side of the block.

Since this is a student task and students have been known to lurk in the forum, I won’t link my code, but once I fixed that small block, it did start working for me. If you still have problems, though, don’t hesitate to post a reply.

Best Wishes!


Many thanks Mike. I now have the counter working.

1 Like