Example:

  1. ' This rather tedious test shows nested select statements and if uncommented,

    ' the exit for statement

    Sub Test ()

    1. For x = 1 to 5

      1. print x

        Select Case x

        1. Case 2

          1. Print "Outer Case Two"

          Case 3

          1. Print "Outer Case Three"

            'Exit For

            Select Case x

            1. Case 2

              1. Print "Inner Case Two"

              Case 3

              1. Print "Inner Case Three"

                'Exit For

              Case Else' Must be something else.

              1. Print "Inner Case Else:", x

            End Select

            Print "Done with Inner Select Case"

          Case Else' Must be something else.

          1. Print "Outer Case Else:",x

        End Select

      Next x

      Print "Done with For Loop"

    End Sub