TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Go Goto Statements

1 pointsby kucingalmost 3 years ago

1 comment

wruzaalmost 3 years ago
Goto is usually used to break out of loops, to skip to cleanup and in state machines. With labeled loop control and defer these usages become unnecessary, but state still has no good alternative (switch is not exactly a substitution, for+switch is indent-noisy).<p>Also, people who hate goto actually do hate state machines carved into a structured code, afaiu. (You can do that without goto, ironically, with the same effect of “wtf is going on”). These have some uses, but mostly in generated algorithms with some natural statefulness.