C# Puzzle : Reachable goto pointing to an unreachable label
Answer:
Quite an interesting piece of code
Here's the original at StackOverflow (with an explanation from Eric Lippert)
Answer:
Code:
bool jumping = false;
try
{
if (DateTime.Now < DateTime.MaxValue)
{
jumping = (Environment.NewLine != "\t");
goto ILikeCheese;
}
return;
}
finally
{
if (jumping)
throw new InvalidOperationException("You only have cottage cheese.");
}
ILikeCheese:
Console.WriteLine("MMM. Cheese is yummy.");
Quite an interesting piece of code