leo/tests/compiler/mutability/circuit_variable_mut.leo

11 lines
182 B
Plaintext
Raw Normal View History

2020-09-03 04:01:47 +03:00
// Adding the `mut` keyword makes a circuit variable mutable.
circuit Foo {
2020-12-01 19:54:51 +03:00
x: u32
2020-09-03 04:01:47 +03:00
}
function main() {
let a = Foo { x: 1 };
2020-09-03 04:01:47 +03:00
a.x = 0;
console.assert(a.x == 0u32);
}