Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

How to Port Goto Code to Java

Name: Anonymous 2014-02-09 16:44

Lets see how we can replace an ugly goto with an elegant structured programming constructs.

Given an unstructured loop

line1:
printf("Dijkstra sucks cocks in hell.\n");
goto line1;


Without sacrificing any expressiveness, we can refactor the above code into:

line = 0;
while (line++ > 0)
{
switch(line)
{
case 1: printf("Dijkstra sucks cocks in hell.\n") break;
case 2: line = 1; break;
}
}


Not only did we killed goto, but also gained a way to address lines of code dynamically. I.e. we can compute the next value of "line" variable.

Name: Anonymous 2014-03-14 7:24

>>11
Wow, someone hasn't heard about INTERCAL? Here's a diagram which should make it all clear: https://upload.wikimedia.org/wikipedia/commons/4/41/INTERCAL_Circuitous_Diagram.svg

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List