How to escape while control structure with implement of switch case

CrossRoads:
Follow the complete library example, save the key value it is returned when a key is pressed

i believe the code should be like this. but, the output on serial monitor is still like the original. only display the number correspond to the keypad number only once. perhaps that my code is somewhere wrong. but, i follow your instruction above.

/*  Keypadtest.pde
 *
 *  Demonstrate the simplest use of the  keypad library.
 *
 *  The first step is to connect your keypad to the
 *  Arduino  using the pin numbers listed below in
 *  rowPins[] and colPins[]. If you want to use different
 *  pins then  you  can  change  the  numbers below to
 *  match your setup.
 *
 */
#include <Keypad.h>

const byte ROWS = 4; // Four rows
const byte COLS = 3; // Three columns

// Define the Keymap
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'#','0','*'}
};

// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = { 0, 2, 9, 10 };
// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = { 11, 12, 13 };

// Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

byte new_key;

void setup()
{
  // set up SERIAL MONITOR: 
  Serial.begin(9600);
}

void loop()
{
  char key = kpd.getKey();
  
  if (key != NO_KEY){
  new_key = key;  //new_key is only updated when a key is pressed
  }
  
  if(key)  // Check for a valid key.

    switch (new_key)
    {
      case '1':
        Serial.println("1");
        break;    // supposed that break the case 1 if other case is being pressed
      case '2':
        Serial.println("2");
        break;
  } // end switch
} //end loop