leo/compiler/tests/mutability/circuit_mut.leo

11 lines
186 B
Plaintext
Raw Normal View History

// Adding the `mut` keyword makes a circuit variable mutable.
2020-07-17 06:47:47 +03:00
circuit Foo {
2020-07-17 22:59:18 +03:00
x: u32
}
2020-07-31 02:37:01 +03:00
function main() {
2020-07-17 22:59:18 +03:00
let mut a = Foo { x: 1 };
a.x = 0;
2020-08-17 05:14:26 +03:00
console.assert(a.x == 0u32);
}