Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Statements

This section is a work-in-progress experiment about making the book executable.

Syntax
Statement:
    | ; => Statement::Empty
    | item=Item => Statement::Item(item)
    | expr=ExpressionStatement => Statement::Expr(expr)
    | statement=LetStatement => statement
LetStatement: attrs=OuterAttribute* let pattern=PatternNoTopAlt ( : ty=Type )?
    ( = initial_value=Expression )?
    ( else else_branch=BlockExpressionNoInnerAttributes )?
    ;
    => Statement::Let { attrs, pattern, ty, initial_value, else_branch }
ExpressionStatement:
    | expr=ExpressionWithoutBlock ; => expr
    | expr=ExpressionWithBlock ;? => expr

#![allow(unused)]
fn main() {
pub enum Statement {
    Empty,
    Item(Item),
    Let {
        attrs: Vec<OuterAttribute>,
        pattern: Pattern,
        ty: Option<Type>,
        initial_value: Option<Expression>,
        else_branch: Option<BlockExpression>,
    },
    Expr(Expression),
}
}