I try to tell the user that ,whenever he types in a string instead of an integer, he/she should type in a number.But somehow the code within the if statement never shows up.
private static void Number()
{
Console.Write("Type it in a number: ");
int result = int.Parse(Console.ReadLine());
if (float.IsNaN(result))
{
Console.WriteLine("Please type a number!");
}
else
{
Console.Write("Hi");
}
Console.ReadLine();
}