Post

VB.NET Wish

Here’s an example.

1
2
3
4
5
6
7
8
For i = 1 To 100
  If i > 5 AndAlso i < 20 Then
    ' Skip over the rest of the processing inside of the loop
    ' and start the next iteration. 
    Continue For '<----- I want this added.
  End If
  ' Do some process.
Next

C# and C++ have this. I didn’t know how useful it was until going through a ton of conversions from C# to VB.NET. It’s handy and it wouldn’t break any of the language rules that are in place. You could have Continue For, Continue Do, and Continue While. Saves you from having to do nested if/then statements or far worse… using goto statements :-(

This post is licensed under CC BY 4.0 by the author.