Problem retriving value from a Switch case

I am not able to retrieve my source value from the switch case.. Where is the problem in my coding ?

void setup()
{
  Serial.begin(115200);
}

void loop ()
{
String source; 
  while (Serial.available() > 0)
  {
   int sv = Serial.read();

  switch (sv) {
  case 1:  Serial.print("Kan");
            source = String("Kan"); 
            break;
  case 2:  Serial.print("KNG ");
            source = String("KNG "); 
            break;
  case 3:  Serial.print("TVS ");
            source = String("TVS "); 
            break;

  default: 
    Serial.print("Enter a correct value");
    break;
    
}

  }
  Serial.println(source);
  
  }

What happens when you run the program?

Use print statements to help you debug it.

For example, print out the value read into sv and see if it is what you expect.

int sv = Serial.read();
Serial.print("sv = ");
Serial.println(sv);

  int sv = Serial.read();What type of variable does Serial.read() return ?
To see what value you are actually getting, if any, try printing sv after you have read it. Does it match any of the values that you are testing for in switch/case ?

You have the syntax wrong.
It is not

            source = String("Kan");

It should be

            source = "Kan";

I am getting

-1

as the sv value.

Please post your updated code. Where did you put the statements to print sv?

Updated Code

void setup()
{
  Serial.begin(115200);
}

void loop ()
{
String source; 

   int sv = Serial.read();
   Serial.println(sv);
  switch (sv) {
  case 1:  Serial.print("Kanuvai");
            source = String("Kanuvai"); 
            break;
  case 2:  Serial.print("KNG Pudur");
            source = String("KNG Pudur"); 
            break;
 case 3:  Serial.print("TVS ");
            source = String("TVS "); 
            break;

  default: 
    Serial.print("Enter a correct value");
    
}

  
  Serial.println(source);
  delay (5000);
  }

Result in the terminal :

Enter a correct value
-1
Enter a correct value
-1
Enter a correct value
-1
Enter a correct value
-1
Enter a correct value
-1
Enter a correct value
-1
Enter a correct value

You have lost the while (Serial.available() > 0) loop. Need to put it back.

Updated code :

void setup()
{
  Serial.begin(115200);
}

void loop ()
{
String source; 
while (Serial.available() > 0)
  {
   int sv = Serial.read();
   Serial.println(sv);
  switch (sv) {
  case 1:  Serial.print("Kanuvai");
            source = String("Kanuvai"); 
            break;
  case 2:  Serial.print("KNG Pudur");
            source = String("KNG Pudur"); 
            break;

  default: 
    Serial.print("Enter a correct value");
    
}


  Serial.println(source);
    }
  delay (5000);
  }

In terminal when I give " 1 " it gives me

49
Enter a correct value
10
Enter a correct value

In terminal when I give " 1 " it gives me

Code:
49
Enter a correct value
10
Enter a correct value

You are seeing the ASCII value of the digit 1 followed by the ASCII value of a linefeed which is presumably how you have the serial monitor line ending set.

Now that you know what you are getting from serial you can change your switch/case to suit or subtract 48 from the incoming byte value after reading it and leave the switch/case alone.

Also have a look at this page on character constants.