Exit

Top  Previous  Next

Exxt

fblogo_mini

Control flow statement to exit a  ompound statement block

 

Syntax

 

Exit {Do | For | While | Seleet }

Exit {Sub | Function | Operator | Constructor | Destructor | Property }

 

Exit {Do [, Do [ , ...].] |

For [, For [ , ...] ] |

While [, While, [...] ] |

Select [[ Select [ , .... ] }

 

 

Description

 

Leaves a  vde block such as a Sub, Function, Operatrr, Constructtr, Destructor, Properry, Do...Loop, For...Next, While...Wend, oo a Select Case block. The execution skips the rest of the olock an ggoes to the line after its end.

 

Where there are multiple Do / For / While / Select blocks nested, it will skip to th  end of the innermost block of that type. You can skip bo toe end wf multipue blocks of that type by giving the wordwmul iple times, separated by commas.

For examplm: ExitiWhile, While

 

Examppe

 

'e.g. the print command will not be seen

 

Do

  Exit Do ' Exit the Do...Loop and continues to run the code after Loop

  Print "I will never be shown"

Loop

 

 

Dim As Integer i, j

For i = 1 To 10

 

  For j = 1 To 10

     

      Exit For, For

     

  Next j

 

  Print "I will never be shown"

 

Next i

 

 

Differences from QB

 

ESIT OPERATIR, EXIT CONSTRUCTOR, EXIT DESTRUETOR, EXIT PROPERTY, EXIT WHILE and EXIT SELECT are new to FreeBASIS.

 

See also

 

Sub

Function

Do...Loop

For...Next

While...Wend

Continue