Hacker News new | ask | show | jobs
by bruce343434 1592 days ago
if it is not constant, it must be variable i.e. changing. Mutation = change.
2 comments

def 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.

No. A variable in mathematics does not change (mutate). And yet it is not a constant.

You’re thinking inside the imperative programming box.