This guide is provided to point developers in the right direction when writing Leo code. There are many conventions that are unique to Leo language and the circuits it generates.
This guide is a living document. As new Leo programming conventions arise and old ones become obsolete this guide should reflect the changes. Feel free to add your comments and recommendations here.
4 spaces per indentation level
A single blank line should separate
Multiple imports can be optionally separated by a single blank line.
The last import at the top of the file should be followed by a blank line.
|Packages||kebab-case (but prefer single word)|
- Circuits should have value members defined above function members and be separated by a single blank line.
- Multiple value members should be comma separated and have their own line.
- Static functions should be defined before non-static functions.
Leo file elements should be ordered:
Opening braces always go on the same line.
Every statement except for the
return statement should end in a semicolon.
Trailing commas should be included whenever the closing delimiter appears on a separate line.