Nokia 5110 LCD not showing anything on screen

I'm using Nokia 5110 LCD with Arduino UNO with Adafruit GFX and PCD8544 libraries. When I use others codes from internet using same libraries, it works but for my programs, it is not working. Can you please tell me what is wrong with my way of programming. To test again, I wrote a basic code which is given below.

// libraries for screen usage
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>

// pins used by the Nokia screen
Adafruit_PCD8544 display = Adafruit_PCD8544(8, 10, 9);

void setup() {  
  Serial.begin(9600);
  
  display.begin();
  display.setContrast(50);  // generally between 40 and 60: it depends on your screen
  display.clearDisplay();
  display.display();
}

void loop() {
  display.setTextSize(1);
  //display.clearDisplay();
  display.setTextColor(BLACK);
  display.setCursor(0, 0);
  display.print("MAIN MENU");  
}

The Adafruit library does have an example that displays text.

So compare the part of that example program (that displays text) with your program, do the comparision line by line.

You will find you have missed something, a command or similar.

srnet:
The Adafruit library does have an example that displays text.

So compare the part of that example program (that displays text) with your program, do the comparision line by line.

You will find you have missed something, a command or similar.

Thank you so much. From example, I have figured it out that I need to write
display.display(); to display the content specified by "display.print(content);

bilalkamboh:
Thank you so much. From example, I have figured it out that I need to write
display.display(); to display the content specified by "display.print(content);

You see, fixed it yourself.

The Adafruit library writes to a memoty buffer, not direct to the screen, so the display.display is needed to write the buffer to the actual screen.