Java Statements

Statements

In Java, statements are terminated by a required semicolon. This allows them to span lines as needed without a continuation character.
Example:
int i = 99 ;


In NetRexx, statements are terminated by an optional semicolon or the end of the line. This means that continuing a line requires a continuation character (-) at the end of the line.
Examples:

i = 99
j = 222 ;


Both languages allow multiple statements on a line, but in practice this is not usually done.
 

Blocks of statements

A group of statements with a start and end delimiter is a block and is equivalent to a single statement.
 
 
A Java block:
A NetRexx block:


int i = 1;
int j = 2; 
}

do
    i = 1
    j = 2
end

Note that a method is just a block with a name so it can be called.

Comments

Both Java and NetRexx allow comments which can span multiple lines using the same start (/*) delimiter and end (*/) delimiter. NetRexx allows these type of comments to be nested - Java does not.

/*  This is an example of a comment valid in Java and NetRexx.    */

Both allow comments on the end of a statement line, but the delimiter is different:

Java statement // comment to end of line
NetRexx statement -- comment to end of line