Man I was going to agree with you until you brought up that you can be healthy eating McDonalds as long as you can control the portions. Eating hyper processed food WILL lead to worse health outcomes, just filter out industry sponsored studies and look at the results.
For sure, this has been something I learned from working in Scala that has made my code in other projects much more readable and easier to reason about. For performance reasons I may need to use mutables, but often I can keep it in the context of the function and just encapsulate it.