G
gordon
Hi,
i am learning c# at home in my spare time (what a life), and i am working
through some examples. I run the following code and i get the following
error when the if condition is not met.
An unhandled exception of type System.FormatException' occurred in
mscorlib.dll
string charval="Hello.";
string pharVal="How are you?";
string input;
try
{
Console.WriteLine("Hey,,,,, {0} {1}",pharVal,charval);
input=Console.ReadLine();
if (input=="1")
Console.WriteLine("Hello {0}", input);
else
Console.WriteLine("Back again? {0)", input);
}
finally
{
}
Sorry if this is a bit too basic - but i just can't work out why the value
of 2 is not acceptable.
i am learning c# at home in my spare time (what a life), and i am working
through some examples. I run the following code and i get the following
error when the if condition is not met.
An unhandled exception of type System.FormatException' occurred in
mscorlib.dll
string charval="Hello.";
string pharVal="How are you?";
string input;
try
{
Console.WriteLine("Hey,,,,, {0} {1}",pharVal,charval);
input=Console.ReadLine();
if (input=="1")
Console.WriteLine("Hello {0}", input);
else
Console.WriteLine("Back again? {0)", input);
}
finally
{
}
Sorry if this is a bit too basic - but i just can't work out why the value
of 2 is not acceptable.