Primitive Types
Move has no signed integers in the classic language, no floating point, and no char type.
7.1 Overview
true / false 255u8, 0xFFu8 64-bit unsigned (default for untyped literals when not inferred) 1u128 << 100 32-byte account/object address @0x1, @my_addr
Capability representing a transaction signer (Aptos; Sui code rarely uses it) not constructible in code Growable homogeneous array
vector[1, 2, 3], b"hello", x"0A0B" Move has no signed integers in the classic language, no floating point, and no char type. Fixed-point math is provided by libraries (std::fixed_point32, std::fixed_point64, aptos_std::math_fixed, or std::uq64_64 on Sui).
7.2 Booleans
let a = true;
let b = !a; // false
let c = a && b; // short-circuit AND
let d = a || b; // short-circuit OR7.3 Addresses
Addresses are 32 bytes on Sui and Aptos (Diem used 16). Leading zeros may be omitted: @0x1 is 0x000...001.
let a: address = @0x1;
let b = @my_addr;
let same = (a == b);
// Sui: an object ID can be converted to an address
// let addr = object::id_address(&obj); or obj.id.to_address()7.4 Signer (Aptos)
A signer represents the authority of an account that signed the transaction. You cannot create one in code; the VM passes it into entry functions:
signer has only the drop ability. On Sui, authority comes from TxContext (ctx.sender()) and from owning objects instead.
public entry fun hello(account: &signer) {
let addr: address = std::signer::address_of(account);
// only `account` itself could have produced this signer
}7.5 Byte strings and hex strings
let bytes: vector<u8> = b"hello"; // ASCII bytes
let escaped = b"line\n"; // escapes: \n \r \t \\ \0 \" \xHH
let raw: vector<u8> = x"48656C6C6F"; // hex literal = b"Hello"