4 ms·
if it is not constant, it must be variable i.e. changing. Mutation = change.
by bruce343434 5y ago
if it is not constant, it must be variable i.e. changing. Mutation = change.
- avgcorrection 5y agoNo. A variable in mathematics does not change (mutate). And yet it is not a constant. You’re thinking inside the imperative programming box.
- ackfoobar 5y agodef plusOne(x: Int) { val y = x + 1; return y } In the line of code above, `y` is an immutable variable. It does not mutate, yet it "varies" as different values of x come in.