By default, variables are immutable. To create a variable that can be modified, use mut:
mut
let mut counter = 0 counter = counter + 1 counter = counter + 1 print(counter) // 2
Goal: Create a counter, increment it 3 times and print the final value (3).
3
Run the code to see the output
9 results