Here is the code
int checkid = 0; //UserId Name 1
// Array.
string[] Userid = {"John","Bob","Dennis"};
Console.WriteLine("What is your User ID : ");
// Get input.
string InputID = Console.ReadLine();
// If the input is not equal to the first name of the array
// then add 1 to checkid to check the next name.
if (InputID != Userid[checkid])
{
checkid++;
}
// If the input is equal to a name on userid
// then print Hi! + (InputID).
else if (InputID == Userid[checkid])
{
Console.WriteLine("Hi! "+ InputID);
}
// If you aren't on the list then it prints error
else
{
Console.WriteLine("Error");
}
So I Want to check if the string inputid is equal to any of the names on the array userid but its not working. I Am getting this error message:
CS8600 - Converting null literal or possible null value to non-nullable type.