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

Languages with GOTO

Name: suomynonA 2007-07-17 12:49 ID:sJhm9IHJ

Is there a modern programming language which has GOTO function in it? I know basic from a millenia ago and recently learned java, and well I hated OOP, but I could live with it if I had goto.

Name: Anonymous 2007-07-21 2:01 ID:+IScw2W8

>>66

And here's the same FSM but slightly less verbose. I've removed the "else" statements and allowed the cases to fall through each other. This lowers the readability, but uses less code. The readability now becomes more like your original example in >>64 while still requiring no goto statements.


char state = 'a';

int stopped = 0;

while(!stopped)
{
    switch(state)
    {
        case 'a':

            do1();

        case 'b':

            if(do2())
            {
                state = 'a';
                break;
            }
               
        case 'c':

            if(do3())
            {
                state = 'b';
                break;
            }

        case 'd':

            if(do4())
            {
                state = 'c';
                break;
            }

        case 'e':
           
            if(do5())
            {
                state = 'd';
                break;
            }
           
        default:
               
            // quit
           
            stopped = 1;
               

    }
}



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