Programming for EC11 encoder (ESP32)

I've searched high and low for code that allows the EC11 encoder to be used with an ESP32. This example works as I expect. One click CW increases the count and one click CCW decreases the count. Now I want to play with the code and make it print words instead of simply showing the counter. In my head head I know how to do it but I just can't come up with the code.

I think the I must make a current count and then take the new count, once clicked and check if it has increased or decreased, and so print the lines accordingly ... and that's where I get lost and confused.

I obviously don't want to be spoon fed but a little prompt in the right direction would be very much appreciated. (I know the code below won't work because it doesn't know what oldCount is.)

void loop(){
  // Loop and read the count


  if(encoder.getCount() > oldCount)
  {
  Serial.println("Encoder UP";
  delay  (200);
  }
  else if(encoder.getCount() < oldCount)
  {
     Serial.println("Encoder DOWN";
  delay  (200);
  }