idiom43-Break outer loop-multidimensional-set-iteration-variable.vb

VbNet · Console

/Program.vb

Option Strict On
Imports System

Public Module Program
	Sub Main()
        Dim m = {
            { 1, 2, 3 },
            { 11, 0, 30 },
            { 5, -20, 55 },
            { 0, 0, -60 }
        }
        
		For i As Integer = 0 To m.GetLength(0) - 1
			For j As Integer = 0 To m.GetLength(1) - 1
                If m(i, j) < 0 Then
                    Console.WriteLine(m(i, j))
					i = Integer.MaxValue - 1 ' Break outer loop
                    Exit For
                End If
            Next
        Next
    End Sub
End Module
;