debugging code
Posted by kevinup on February 23, 2009
I was helping another developer debug some code the other day. We had an if statement, that when it was true, it should throw an exception. The problem was the exception was being throw every time even when we knew the expression should have been evaluated to false. I had to laugh when I saw the code and realized what was going on.
bool some_expression_that_evaluates_false = false;
if (some_expression_that_evaluates_false);<-------------
{
Console.WriteLine("Why is this code executing?");
throw new Exception();
}
