brain icon indicating copy to clipboard operation
brain copied to clipboard

Immutability by default

Open sunjay opened this issue 7 years ago • 0 comments

Declarations should be immutable by default. To make them mutable, use the mut keyword as demonstrated below. This should be statically checked and enforced by the compiler.

let x: u8 = 19;
// Errors:
//x = 90;
//decrement(x);

let mut y: u8 = 17;
// Works:
y = 90;
decrement(y);

Started in #63.

sunjay avatar Mar 12 '17 14:03 sunjay