Exit Statement [Runtime]/text/sbasic/shared/03090412.xhpExit statementExit Statement [Runtime]Exits a Do...Loop, For...Next, a function, or a subroutine.Syntax:see ParametersParameters:Exit DoOnly valid within a Do...Loop statement to exit the loop. Program execution continues with the statement that follows the Loop statement. If Do...Loop statements are nested, the control is transferred to the loop in the next higher level.Exit ForOnly valid within a For...Next loop to exit the loop. Program execution continues with the first statement that follows the Next statement. In nested statements, the control is transferred to the loop in the next higher level.Exit FunctionExits the Function procedure immediately. Program execution continues with the statement that follows the Function call.Exit SubExits the subroutine immediately. Program execution continues with the statement that follows the Sub call.The Exit statement does not define the end of a structure, and must not be confused with the End statement.Example:Sub ExampleExitDim sReturn As StringDim sListArray(10) as StringDim siStep as SingleFor siStep = 0 to 10 REM Fill array with test datasListArray(siStep) = chr(siStep + 65)msgbox sListArray(siStep)next siStepsReturn = LinSearch(sListArray(), "B")Print sReturnend subFunction LinSearch( sList(), sItem As String ) as integerdim iCount as IntegerREM LinSearch searches a TextArray:sList() for a TextEntry:REM Returns the index of the entry or 0 ( Null)for iCount=1 to Ubound( sList() )if sList( iCount ) = sItem thenExit for REM sItem foundend ifnext iCountif iCount = Ubound( sList() ) then iCount = 0LinSearch = iCountend function