Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

feat: Optional ; in the last statement in the block #276

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pages/book/statements.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,22 @@ fun getTimeFromNow(offset: Int): Int {

A block statement is used to group zero or more statements. The block is delimited by a pair of braces ("curly braces", `{}{:tact}`) and contains a list of zero or more statements and declarations.

Some statements, such as [`let{:tact}`](#let) or [`return{:tact}`](#return), must end with a terminating semicolon `;{:tact}`. However, the semicolon of the last statement in the block is optional and may be omitted.

```tact
{ // <- start of the block
// arbitrary statements:
let value: Int = 2 + 2;
dump(value);
} // <- end of the block

{ dump(2 + 2); } // a block with only one statement
{ dump(2 + 2) } // a block with only one statement,
// omitted the last and only semicolon

{
let nah = 3 * 3 * 3; // a block with two statements,
let yay = nah + 42 // but without the last semicolon
}
```

## Expression
Expand Down
Loading