Is having mutable local variables in a function that are only used internally, (e.g. the function has no side effects, at least not intentionally) still considered "non functional"?
e.g. in the "Functional programming with Scala" course style check considers any var usage as bad
My question, if the function has no side effects, is writing imperative style code still discouraged?
e.g. instead of using tail recursion with the accumulator pattern, what's wrong with doing a local for loop and creating a local mutable ListBuffer and adding to it, as long as the input is not changed?
If the answer is "yes, they are always discouraged, even if there is no side effects" then what is the reason?
varis always non-functional. Scala has lazy vals and tail recursion optimization, which allow to avoid vars completely.