Can anybody explain me why this simple Arduino sketch doesn't work as expected?

Arduino IDE 1.8.19.
Platform: Arduino Micro and Arduino UNO (replacing PORTF with PORTD as UNO doesn't have PORTF..).
This sketch should simply make one shot writes to the higher nibbles on PORTB and PORTF.
The first writes work... the second nope (..and so the 3rd, the 4th, ...).

void setup() {
Serial.begin(115200);
while (! Serial);
DDRB = DDRB | 0b11110000;  // high nibble as OUT
DDRF = DDRF | 0b11110000;  // high nibble as OUT

// print initial PORTs state
Serial.print(F("PORTB,PORTF = "));
Serial.print(PORTB,HEX);Serial.print(",");Serial.println(PORTF,HEX);

//set PORTs to the desired values
PORTB |= 0x30;
PORTF |= 0x50;

//verify: OK
Serial.print(F("PORTB,PORTF = "));
Serial.print(PORTB,HEX);Serial.print(",");Serial.println(PORTF,HEX);

//set PORTs again with new values
PORTB |= 0x40;
PORTF |= 0x60;

//verify: FAILS!!
Serial.print(F("PORTB,PORTF = "));
Serial.print(PORTB,HEX);Serial.print(",");Serial.println(PORTF,HEX);
}

void loop() {
return;
}

The output is:

PORTB,PORTF = 1,0
PORTB,PORTF = 31,50
PORTB,PORTF = 71,70

Nothing changes if the code is run in loop().

Thank you for your help!
Emanuele.

ask yourself what 0x30 | 0x40 equals

I don’t get it, did you say you replaced PORTF?

aaah!!
The ones accumulate in the nibbles! Got it!
To get what I wanted the new value assignments must look like this:

//set PORTs the desired values
PORTB = (PORTB & 0x0F) | 0x30;
PORTF = (PORTF & 0x0F) | 0x50;

Sorry for the noise!
Thank you.