| /** |
| ## Control structures |
| |
| See [Control structures](control-flow.html) |
| */ |
| |
| controlStructureBody |
| : block |
| : blockLevelExpression |
| ; |
| |
| if |
| : "if" "(" expression ")" controlStructureBody SEMI? ("else" controlStructureBody)? |
| ; |
| |
| try |
| : "try" block catchBlock* finallyBlock? |
| ; |
| |
| catchBlock |
| : "catch" "(" annotations SimpleName ":" userType ")" block |
| ; |
| |
| finallyBlock |
| : "finally" block |
| ; |
| |
| loop |
| : for |
| : while |
| : doWhile |
| ; |
| |
| for |
| : "for" "(" annotations (multipleVariableDeclarations | variableDeclarationEntry) "in" expression ")" controlStructureBody |
| ; |
| |
| while |
| : "while" "(" expression ")" controlStructureBody |
| ; |
| |
| doWhile |
| : "do" controlStructureBody "while" "(" expression ")" |
| ; |