Greenfoot Common Errors

If the world becomes greyed out and you can't click on anything then an error has occurred.

The actor with the error will have red lines on it.

When an error occurs, a red squiggly line will appear underneath the problem. Hover your mouse over the line and a helpful message will appear to help you solve the issue.

Some of the more common errors (and how to fix them) are listed below:

; expected

Every line with a white background must end in a semi colon ( ; ).

) expected

You have missed a bracket. Count the number of open brackets and the number of closed brackets on a line and make sure you have an equal amount of both.

reached end of file while parsing

You are missing at least one curly bracket ( } ) at the end of your program.

 

Press enter to move onto a new line at the bottom; you must have a closed curly bracket with a yellow background and another closed curly bracket with a green background.

cannot find symbol

You have mistyped a command. Greenfoot uses a system where commands have no spaces and each word after the first word is uppercase. Such as isKeyDown, not IsKeyDown or isKeydown. Check your spelling and capitals carefully.

required: Counter

When creating and coding the counter, you need to type counter into the brackets of each object that will interact with the counter.

This code is found by editing MyWorld.

Stuck?

If you start typing but can't remember what commands come next, press Ctrl and Space together to show a list of all possible commands that you can use.

© CSNewbs 2020