mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-21 08:31:33 +03:00
612 B
612 B
Member variables after circuit functions
Example
This error occurs when circuit member variables occur after circuit member functions.
Erroneous code example:
circuit Foo {
function bar() {}
baz: bool;
}
The compiler will reject this code with, for example...:
Error [EPAR0370022]: Member functions must come after member variables.
--> test.leo:4:5
|
4 | baz: bool;
| ^^^
Solution
The issue can be solved by moving all member variables before any circuit member functions...:
circuit Foo {
baz: bool;
function bar() {}
}