Home > Technology > What’s wrong with goto statements?

What’s wrong with goto statements?

Found this on the Channel 9 forum. It can be replaced by 4 lines of code.
int n, end = 0;
    here:
    n = 0;
    if(end == 0)
goto uuu;
    goto fiftyfive;
www:
    goto tnt;
xz:
    goto three;
two:
    n++;
    goto four;
uuu:
    end = 100;
    goto here;
    fiftyfive:
three:
    goto two;
nine:
    Console.WriteLine(n.ToString());
    goto www;
five:
    n = -2;
    goto three;
zero:
    if (n < 0)
goto end;
    goto nine;
four:
    goto zero;
tnt:
    if (n == end)
goto five;
    goto xz;
end:
    Console.ReadKey();
Advertisements
Categories: Technology
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: