1 point
In all those cases, the answer is to swap in a new variable and throw the old one away.
Legit question because i think I’m misunderstanding. But if its a const, how are you able to swap or replace it?
5 points
It’s only a const within a function. You can pass the value to another function and changing it as it’s passed. For example:
const int foo = 1
other_func( foo + 1)
In functional programming, you tend to keep track of state on the stack like this.
1 point