Functional Programming Battles GOTOzilla
Posted by: K. Scott Allen,
on 17 Jun 2009 |
View original | Bookmarked: 0 time(s)
Steve Wellens had a recent blog post arguing for the use of a goto in C# (see: Why goto Still Exists in C#). Steve had a series of methods he wants to execute, but he wants to stop if any given method returns false. At the end of the post, Steve decided that the following code with goto was better than setting boolean variables: // DoProcess using goto
void DoProcess3()
{
LOG("DoProcess Started...");
if (Step1() == false)
goto EXIT;
if (Step2() == false)
goto EXIT;
...