Skip to content

Commit

Permalink
[move book] Adding docs for 2.1 language release
Browse files Browse the repository at this point in the history
Adds loop label documentation and updates the release notes.
  • Loading branch information
wrwg committed Oct 20, 2024
1 parent 1fd1844 commit ed81203
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
4 changes: 2 additions & 2 deletions apps/nextra/pages/en/build/smart-contracts/book/_meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ export default {
SUMMARY: {
title: "Summary",
},
"move-2.0": {
title: "Move 2.0 Release Notes",
"move-2": {
title: "Move 2 Release Notes",
},
"---getting-started---": {
type: "separator",
Expand Down
25 changes: 25 additions & 0 deletions apps/nextra/pages/en/build/smart-contracts/book/loops.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,28 @@ script {
}
}
```

## Loop Labels

_Since language version 2.1_

A `while` or `loop` statement can have a label which can be referred to by a `break` or `continue` statement. In the presence of nested loops, this allows to refer to outer loops. Example:

```move
script {
fun example(x: u64): u64 {
'label1: while (x > 10) {
loop {
if (x % 2 == 0) {
x -= 1;
continue 'label1;
} else if (x < 10) {
break 'label1
} else
x -= 2
}
};
x
}
}
```
20 changes: 0 additions & 20 deletions apps/nextra/pages/en/build/smart-contracts/book/move-2.0.mdx

This file was deleted.

4 changes: 2 additions & 2 deletions apps/nextra/pages/en/build/smart-contracts/compiler_v2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: "Move On Aptos Compiler (beta)"

The Move on Aptos compiler (codename 'compiler v2') is a new tool which translates Move source code into Move bytecode. It unifies the architectures of the Move compiler and the Move Prover, enabling faster innovation in the Move language. It also offers new tools for defining code optimizations which can be leveraged to generate more gas efficient code for Move programs.

The new compiler supports Move 2, the latest revision of the Move language. Head over to the [release page in the book](book/move-2.0.mdx) to learn more about the new features in Move 2. You can select both this language version and the new compiler by using `aptos move compile --move-2`.
The new compiler supports Move 2, the latest revision of the Move language. Head over to the [release page in the book](book/move-2.mdx) to learn more about the new features in Move 2. You can select both this language version and the new compiler by using `aptos move compile --move-2`.

## Compiler v2 Release State

Expand Down Expand Up @@ -37,4 +37,4 @@ To run compiler v2 and Move 2, pass the flag `--move-2` to the Aptos CLI. Exampl
aptos move compile --move-2
aptos move test --move-2
aptos move prove --move-2
```
```

0 comments on commit ed81203

Please sign in to comment.