A Leo program contains declarations of Imports, Functions, Circuits, and Tests. Ordering is not enforced. However, it is best practice to declare imports at the top of the file and tests at the bottom. Declarations are locally accessible within a program file. If you need a declaration from another program file, you must import it.
Functions contain statements that can compute values. Functions must be in a program's current scope to be called.
Circuits are similar to structs in object-oriented languages. They can contain members that store values or declare functions.
Imports fetch other circuits and functions and bring them into the current file scope.
You can import dependencies that are declared locally in the
src directory or downloaded to the
The main.leo file in a Leo project is similar to a binary executable created in languages such as Rust. Leo CLI commands use main.leo as a starting point to pass in witness input values and generate proofs to produce a result.