Learn the fundamental syntax of Move - modules, variables, types, and functions
Move is a programming language for blockchains. It's designed for digital assets and safety. Used by Sui blockchain. We'll start with basic syntax, just like learning any programming language!
Everything in Move lives in a module. A module is like a container for your code. Syntax: module package_name::module_name { ... }
Comments help explain your code to other developers (and future you!). Move supports single-line (//) and multi-line (/* */) comments.
Move has integer types for different size numbers. u8 for small (0-255), u64 for large numbers, u128 for very large numbers. The 'u' means unsigned (no negative numbers).
Boolean type (bool) represents true or false values. Used for yes/no decisions in your code.
Use 'let' to create variables. You must specify the type. Syntax: let name: type = value;
Variables are immutable by default (can't change). Use 'let mut' to make them mutable (changeable).
Move supports standard arithmetic: addition (+), subtraction (-), multiplication (*), division (/), and modulo (%).
Compare values with: equal (==), not equal (!=), greater (>), greater/equal (>=), less (<), less/equal (<=). All return true or false.
Functions do a specific task. Syntax: fun name(param: type): return_type { ... }. The last expression is returned automatically!
Call functions with function_name(arguments). Must provide all required parameters.