Can a sketch write to EEPROM while it is running.?

I understand now that it´s possible to write in EEPROM from the loop but only when data needs to be written.

Regarding the way to test values, if you can give me an example it would help me a lot. I just don´t figure out the way to do it myself.