Exit For

Early termination of a For loop.

Syntax:  Exit For
 

Example:

Dim flg As Boolean
Dim x As uInteger, target As uInteger
Dim a(20) As uByte

' Setup Array here

' Search array for a matching value
flg=0
For x=0 to 19
  If target=a(x) Then
     flg=1: Exit For   ' Target found
  End If
Next x

If flg=1 Then
   ' found at index x
Else
   ' Not Found
End If

 

Also See: For, Continue For