While Loop won't exit with keypad input [SOLVED]

Hi everyone, I am having trouble with a loop in my code that won't exit when I expect it to. It's supposed to take each keypad press, display it on an LCD, save it into a x-digit number for x presses, and exit the loop to the next part when the * key is pressed. I think either I'm doing something wrong with the type of data for the variables being compared, or else my understanding of while loops is wrong. Anyways here's the relevant section of code:

char asciiNum2 = 69;
String paidNumAscii = "";
char star = 42;

      while (asciiNum2 != star){
        char asciiNum2 = myKeypad.waitForKey();
        
        lcd.print(asciiNum2);
        paidNumAscii += asciiNum2;

        Serial.println(asciiNum2);
        Serial.println(star);
        Serial.println(paidNumAscii);
      }

The idea is that it will see asciiNum2 == star when * is pressed and it will exit the loop. The numbers print on the LCD fine but its prints the * and doesn't move to the next command. This is the serial output when I type in 7 0 * on the keypad:

7
*
7
0
*
70
*
*
70*

In the last group of 3 we can see asciiNum2 and star both come out as *. I'm not too experienced so any help or advice is much appreciated!

You are testing a variable that is different from the one you read the key into, even if they happen to have the same name.

      while (asciiNum2 != star){
        char asciiNum2 = myKeypad.waitForKey();

Do not redefine asciiNum2, just use it.

This should work better

      while (asciiNum2 != star){
        asciiNum2 = myKeypad.waitForKey();

Whandall:
You are testing a variable that is different from the one you read the key into, even if they happen to have the same name.

AKA "variable hiding". Wish the compiler gave warnings about this. Might be nice to see if I can get c++ lint going on this machine.

It works great now, thanks so much!