5 Statements

5.1 Syntax

statement labeled‑statement | control‑statement | increment‑statement | decrement‑statement | expression‑statement | assignment‑statement | construction‑statement | empty‑statement | throw‑statement | try‑statement | using‑statement | lock‑statement
labeled‑statement label‑id : statement
label-id identifier
control‑statement compound‑statement | return‑statement | if‑statement | while‑statement | do‑statement | for‑statement | foreach‑statement | break‑statement | continue‑statement | goto‑statement | switch‑statement | goto‑case‑statement | goto‑default‑statement
compound‑statement { statement* }
return‑statement return expression? ;
if‑statement if ( expression ) statement ( else statement )?
while‑statement while ( expression ) statement
do‑statement do statement while ( expression ) ;
for‑statement for ( for‑init‑statement expression? ; for‑loop‑statement‑expression ) statement
for‑init‑statement assignment‑statement | construction‑statement | empty‑statement
for‑loop‑statement‑expression (increment‑statement‑expression | decrement‑statement‑expression | assignment‑statement‑expression)?
increment‑statement‑expression ++ expression | expression ++
decrement‑statement‑expression -- expression | expression --
assignment‑statement‑expression expression = expression
foreach‑statement foreach ( type‑expr identifier in expression ) compound‑statement
break‑statement break ;
continue‑statement continue ;
goto‑statement goto identifer ;
switch‑statement switch ( expression ) { (case‑statement | default‑statement)* }
case‑statement (case constant‑expression : )+ statement*
default‑statement default : statement*
goto‑case‑statement goto case constant‑expression ;
goto‑default‑statement goto default ;
assignment‑statement assignment‑statement‑expression ;
construction‑statement‑expression type‑expr identifier (= expression)?
construction‑statement construction‑statement‑expression ;
increment‑statement increment‑statement‑expression ;
decrement‑statement decrement‑statement‑expression ;
empty‑statement ;
throw‑statement throw expression? ;
try‑statement try compound‑statement catch+ finally?
catch catch ( type‑expr identifier ) compound‑statement
finally finally compound‑statement
using‑statement using ( construction‑statement‑expression ) statement
lock‑statement lock ( expression ) statement