Your following condition seems to be culprit. You are using
inserted
variable while you are taking input and putting it in
userChar
.
Either use
inserted
at both places or change your
while
condition. Try the following:
if(char.TryParse(input, out char userChar))
{
answers[i] = userChar;
}
or you need to use
inserted
in your
TryParse
method call:
if(char.TryParse(input, out char inserted))
{
answers[i] = inserted;
}