Reading through this, the example code for the Purity information was a bit confusing. The original example tried to show both using and changing global state in one function, but because of that the "pure" example and "unpure" example didn't actually do the same thing.
I think it's a little more clear if the two concepts are broken up, instead showing the "pure" version, one that uses global state, and one that modifies global state.
Reading through this, the example code for the Purity information was a bit confusing. The original example tried to show both using and changing global state in one function, but because of that the "pure" example and "unpure" example didn't actually do the same thing.
I think it's a little more clear if the two concepts are broken up, instead showing the "pure" version, one that uses global state, and one that modifies global state.