When you include code in a post, please use the [code] tags so that it's easy for other people to read, find line numbers in, and copy/paste the code. Usually, you can do this by clicking the 'code' link just below the text area in which you type your post. If that doesn't work in your browser, you can manually write '[code]' before your code and '[/code]' just after it.
For example, if you write this:
[code] void myMethod() { return; } [/code]
... then the code will be displayed nicely in your post, like this:
void myMethod() { return; }
Your code should be properly indented when you post it, to make it easier for others to read and understand your code. You can indent your code correctly automatically by pressing ctrl+shift+I in the editor.
If you don't understand the rules of indentation, here's a brief guide:
class Ant extends Actor { public void act() { if (Greenfoot.isKeyDown("up")) { move(5); // <-- this line is indented from the '{' and '}' // containing it (the line above and below) } // <-- this is at the same column as the matching 'if' statement } // <-- this is at the same column as the matching '{' at the // beginning of the 'act' method } // <-- this is at the same column as the matching '{' (on the second line)
Notice that: