To add to what Wendelus has said, remove all the
goto
statements and all the labels - replace them with loops like
while
:
while (true)
{
Console.WriteLine("Which number do you want to divide by?");
int division;
if (int32.TryParse(Console.ReadLine(), out division))
{
if (division == 0)
{
Console.WriteLine("Cannot divide by 0");
}
else
{
Console.WriteLine("$Your answer is {number / division}");
break;
}
}
}
Your code becomes much more readable, and it's a lot harder to generate "spaghetti code" that is hard to understand and maintain.
Then forget
goto
even exists for five years or so - by then you'll understand when it is a good idea to use it! (And I've been coding in C# for 15 years or more, and I've
never had to use one!)