Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 907 Bytes

Expression-Statement.md

File metadata and controls

38 lines (28 loc) · 907 Bytes
title parent
Expression Statement
Statements.md

Syntax

expr_stmnt     ::= expr;
                 | stmt_like_expr

stmt_like_expr ::= block_expr
                 | for_expr
                 | if_expr
                 | while_expr
                 | with_expr

An expression statement is an expression followed by a semicolon. However, for some so-called statement-like expressions the semicolon can be elided.

Typing

The expr or stmnt_like_expr may have any type except <no-return>.

Semantics

The expression evaluates while its computed value is discarded. An expression statement is usually used in order to evaluate side-effects. Impala emits a warning if an expression does not have a side-effect.

Example

f();
23; // warning: expression without side-effect
if true { true } else { false } // no semicolon needed for a stmt_like_expr