7 ms·
Math doesn't have vars, only vals
by iopq 13y ago
Math doesn't have vars, only vals
- mbrock 13y agoThat's a rather strange assertion, if you mean "variables" and "values." Math distinguishes between variables and values. Variables have different values. Values can be bound to variables. Sometimes we do math with mostly variables and few values -- that's called algebra.
- iopq 13y agoI mean Scala vars can be changed during the program, while Scala vals can't. val y = Console.readInt var x = y + 1 x = y + 2 //valid y = 5 //error, vals can't be changed in the same block