Skip to content
🎉 Welcome to the new Aptos Docs! Click here to submit feedback!

Move 2 Release Notes

The Move 2 language releases are described on this page. The reference documentation of the new features is integrated into the book, and marked in the text with “Since language version 2.n”.

Move 2.1

The Move 2.1 language release adds the following features to Move:

  • Compound Assignments One can now use x += n, x -= n, etc. to combine assignments and arithmetic operations. See reference doc here for the supported operations.

  • Loop Labels One can now use labels for loops and have a break or continue expression refer to those labels. This allows to continue or break outer loops from within nested loops. See reference doc here.

Move 2.0

The Move 2.0 language release adds the following features to Move:

  • Enum Types add the option to define different variants of data layout in one storable type. They are documented in the Enum Type section.

  • Receiver Style Functions add the ability to call functions in the familiar notation value.func(arg). They are documented in this section.

  • Index Notation allows to access elements of vectors and of resource storage with notations like &mut vector[index], or &mut Resource[addr], respectively.

  • Positional Structs allow to define wrapper types such as struct Wrapped(u64). Positional structs are described here. Enum variants are also allowed to be positional.

  • Dot-dot pattern wildcards enable statements like let Struct{x, ..} = value to match selective parts of data. They are described here. Those patterns are also allowed for enum variants.

  • Package visibility allows to declare a function to be visible anywhere inside, but not outside a package. Friend functions continue to be supported, although package visibility is in many cases more suitable. As a more concise notation, package and friend functions can be simply declared as package fun or friend fun, respectively, instead of the longer public(package) fun and public(friend) fun. This feature is documented here.

  • Assert abort code optional The assert! macro can now be used with just one argument, omitting the abort code, in which case a default code will be chosen. See also here.

  • New Cast Syntax Until now, casts had to always be in parentheses, requiring code like function((x as u256)). This requirement is now dropped and casts can be top-level expressions without parenthesis, as in function(x as u256). One still needs to write (x as u64) + (y as u64) in expressions. This similarly applies to the new enum variant test, data is VersionedData::V1.