Every function has side effects and variables will need to be modified in multiple places in the same frame
We try to avoid exactly that, because it is what caused us man-years of bug-hunting and bug-fixing over our past projects. Our end-goal (that is still very far away...) would be to have the state from the previous frame and the user inputs, do only pure computations based on this data, and write out a new state before rendering the current frame.
We do use C++ though (because Unreal, and console platforms), what makes this extra hard, because C++ is a language for writing bugs, not for writing software.