Brackets

When typing anything that requires curly brackets (conditionals, loops, functions, classes, etc), the first bracket goes on the same line as the definition. There is a space between the curly bracket and the end of the definition

BAD:

public void eatWombats()
{

public void eatWombats()




{

void eatWombats(){

GOOD:

public void eatWombats() {

The second curly bracket will have its own line after the last line of the function

BAD:

void eatWombats(){foo();}
void eatWombats(){
foo();}

GOOD:

Each time an opening curly bracket is encountered, indent by an extra tab.

Last updated

Was this helpful?