In a sense, global variables and mutable state are much the same. Even if the scope of the mutable variable is local, if it maintains state beyond any specific call, it has a global lifespan. I think using mutable variables within a function that don't live beyond the function is generally fine (for loops, etc).