@@ -24,11 +24,11 @@ https://discord.gg/aleo
2424
2525### Looking for [ More Aleo Resources?] ( ../00_getting_started.md )
2626
27- # Style Guide
27+ ## Style Guide
2828
2929
3030This guide is provided to point developers in the right direction when writing Leo code.
31- There are many conventions that are unique to Leo language and the circuits it generates.
31+ There are many conventions that are unique to the Leo language and the circuits it generates.
3232
3333This guide is a living document.
3434As new Leo programming conventions arise and old ones become obsolete this guide should reflect the changes.
@@ -90,7 +90,6 @@ program prog.aleo {
9090| Function Parameters | snake_case |
9191| Variables | snake_case |
9292| Inputs | snake_case |
93- ```
9493
9594### Layout
9695Leo file elements should be ordered:
@@ -100,6 +99,7 @@ Leo file elements should be ordered:
100994 . Records + Structs
1011005 . Functions + Transitions
102101
102+
103103### Braces
104104Opening braces always go on the same line.
105105``` leo
@@ -121,7 +121,7 @@ let a: u32 = 1u32;
121121let b: u32 = a + 5u32;
122122b *= 2u32;
123123
124- return b
124+ return b;
125125```
126126
127127### Commas
@@ -148,14 +148,14 @@ For precise control over the circuit size, it is recommended to use ternary expr
148148
149149``` leo title="Example:"
150150if (condition) {
151- return a
151+ return a;
152152} else {
153- return b
153+ return b;
154154}
155155```
156156
157157``` leo title="Alternative:"
158- return condition ? a : b
158+ return condition ? a : b;
159159```
160160
161161#### Why?
@@ -168,11 +168,11 @@ We cannot resolve the return statements before evaluating the condition.
168168As a solution, Leo creates branches in the circuit so both paths can be evaluated.
169169
170170``` leo title="branch 1, condition = true"
171- return a
171+ return a;
172172```
173173
174174``` leo title="branch 2, condition = false"
175- return b
175+ return b;
176176```
177177When the input value ` condition ` is fetched at proving time, we select a branch of the circuit to evaluate.
178178Observe that the statement ` return a ` is repeated in both branches.
0 commit comments