Loading...

December 8, 2009

Groovy Goodness: Semicolons are Optional

In Groovy we can leave out semicolons at the end of the line. As long as we use one statement per line. If we use multiple statements on a line we must use a semicolon to separate the statements.

assert true
assert !false

assert true; assert !false  // Need semicolon to separate statements.

assert true;  // Optional, so we can use them at the end of the line.
assert !false;