Statements and expressions
Nim uses the common statement/expression paradigm: Statements do not produce a value in contrast to expressions. However, some expressions are statements.
Statements are separated into simple statements and complex statements. Simple statements are statements that cannot contain other statements like assignments, calls, or the return statement; complex statements can contain other statements. To avoid the dangling else problem, complex statements always have to be indented. The details can be found in the grammar.
- Statement list expression
- Discard statement
- Void context
- Var statement
- Let statement
- Special identifier _ (underscore)
- Tuple unpacking
- Const section
- Static statement/expression
- If statement
- Case statement
- When statement
- When nimvm statement
- Return statement
- Yield statement
- Block statement
- Break statement
- While statement
- Continue statement
- Assembler statement
- Using statement
- If expression
- When expression
- Case expression
- Block expression
- Table constructor
- Type conversions
- Type casts
- The addr operator
- The unsafeAddr operator
当前内容版权归 nim-lang.org 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 nim-lang.org .