I would like to know what to put in the if statement brackets to tell the program, if x or y equals a double, it can break out and continue carrying out the rest of my code.
Any suggestions?
while (true)
{
Console.Write("I need to pour this much from this one: ");
string thisOne = Console.ReadLine();
Double.TryParse(thisOne, out x);
if ( /* Here I want to put "x is a number/double*/ )
{
break;
}
}
while (true)
{
Console.Write("I need to pour this much from that one: ");
string thatOne = Console.ReadLine();
Double.TryParse(thatOne, out y);
if (/* Here I want to put "y is a number/double*/)
{
break;
}
}
Double.TryParse
. Hint: It returns a boolean. – D Stanley Jul 23 '14 at 12:27