GOTO lunch

30 Aug 2005  in mid-afternoon  Matt Winckler

Now here is something dumb. VB.NET has no equivalent for C#’s continue statement. continue, when used within a loop structure, causes the code to skip to the next iteration of that loop. It’s handy in a variety of situations and helps you write clean code.

That lack of an equivalent is pretty dumb. But that’s not the best part. The best part is VB’s “alternative” to continue. According to a Microsoft “MVP” (whatever that means) in a forum addressing this problem, the best alternative to use in VB.NET is GoTo to skip to the line just before Next. Yes. Read that again. GoTo. As in, “go to the specified label”. As in, “VB.NET: Putting the BASIC Back in Visual Basic”.

Unbelievable.

For those unfamiliar with GoTo, BASIC, or Edsger Dijkstra, do everyone a favor: before using a GoTo statement, go outside, walk around the building five times, and dunk your head in a bucket of ice water. If you still feel like using GoTo, then go home, administer yourself five tequila shooters, and go to bed. If, when you wake up the next morning, you still feel like using GoTo, do everyone a favor and go get a job trimming shrubbery.

GoTo! *shudder*

React

This comment form is Markdown-enabled, in addition to allowing the following XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .