I always read about the horrible thing that “goto” is. But today, reading about the Google programming language Go, I see that it suports Coroutines (Goroutines).
The question is:
Coroutine == GoTo
Coroutine != GoTo?
Goroutines are not the same as a goto – they run in parallel with the main code. When you state something like (from their example at http://golang.org/doc/effective_go.html)
go list.Sort(); // run list.Sort in parallel; don't wait for it.
the mainline code continues on – it doesn’t wait for the sort to finish. The sort routine starts up on its own lightweight thread of execution and when it finishes the sort that thread exits.
A goto would cause the mainline code to branch to a separate execution path – so the statements after the
goto would never get run.
Answered By – Aaron
Answer Checked By – David Marino (GoLangFix Volunteer)