

Ask YC: What replaced GOTO? - jackarcalon

I don't understand how you can write a program without 'GOTO'.
How does the computer know where to go in a 100000 line program without line numbers?
Could someone post a link to a modern example?
They didn't know the answer at Digg.
======
noodle
simple answer: goto exists on the assembly level as jump commands (and
others). when you write a c program, it gets, eventually, translated down into
the level where jump commands (gotos) do exist. they do still, in a way,
exist.

higher level languages used to have gotos, but as software engineering
practices developed, they were tossed out because they cause more problems
than they solve. they don't mix well with the practices being developed.

don't use goto. make good use of conditional structures, looping,
functions/methods, and/or recursion.

