Simple EEPROM Code for Arduino to act as a Boolean

So I'm new to using Arduino's in general and just want to have my code by reversed each subsequent startup using the eeprom on my Arduino uno. I've been trying to read up on how to use the eeprom but I'm kind of confused so I've posted below a picture of some sample code that I think should work (but it's probably wrong). Basically I want to on start-up, execute some code, and next startup it executes some other code (the reverse of the original. Then the next startup to execute the original code. I'm unsure of how to fit my Boolean system into the loop part though, so any help would be greatly appreciated!

So What I want this code to do is the first time I power the Arduino to print "Code A". Then after its shutdown, and restarted again to print "Code B" But what I get at the moment is

The problem is that during setup, you first write the EEPROM address to 1 and printA, and then you read the same address which is now 1 so the if condition is again true.

What you should use :

if(EEPROM.read(address)==0)
{
Serial.println('A');
} else {
{
Serial.println('B');

• void setup() is executed once everytime arduino is reset. Which is when you power it up, reset it other means or flashed. Jan 8 at 5:30