Copies vs Shared State
When changes do and don't ripple out.
When Do Changes Spread?
Sometimes editing one variable also edits another, and sometimes it does not. The difference is copy versus shared state. 🔍
A Copy Is Self-Contained
When you get a copy, you hold separate data. Editing it cannot reach back and disturb the value you copied from.
var a = 1
var b = a
b = 2All lessons in this course
- What Value Semantics Means
- Copies vs Shared State
- Mojo's Safe Default
- A First Look at Mutation