Knowledge Garden

Search

Search IconIcon to open search

Memory Safety in Rust

Last updated Oct 31, 2022 Edit Source

# Memory Safety

rust guarantees memory safety at compile time

Variables must be initialized

1
2
3
4
5
6
7
8
9
fn main()
{
	let enigma: i32;
	if true {
		enigma = 42;
	} else {
		enigma = 7;
	}
}

this works because the compiler can tell what a value would be at runtime.