IBM Lotus Symphony
|
退出 Do...Loop、For...Next、函数或子例程。
请参阅“参数”部分
Exit Do
仅在 Do...Loop 语句内有效,作用是退出循环。程序继续执行 Loop 语句之后的语句。如果 Do...Loop 语句是嵌套语句,控制权将传递到下一个较高级别的循环中。
Exit For
仅在 For...Next 循环内有效,作用是退出循环。程序继续执行 Next 语句之后的第一条语句。在嵌套语句中,控制权将传递到下一个较高级别的循环中。
Exit Function
立即退出函数过程。程序继续执行函数调用之后的语句。
Exit Sub
立即退出子例程。程序继续执行子例程调用之后的语句。
![]() |
Exit 语句未定义结构的结束,因此切勿将其与 End 语句混淆。 |
Sub ExampleExit
Dim sReturn As String
Dim sListArray(10) as String
Dim siStep as Single
For siStep = 0 to 10 REM Fill array with test data
sListArray(siStep) = chr(siStep + 65)
msgbox sListArray(siStep)
next siStep
sReturn = LinSearch(sListArray() , "B")
Print sReturn
end sub
Function LinSearch( sList() , sItem As String ) as integer
dim iCount as Integer
REM 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 then
Exit for REM sItem found
end if
next iCount
if iCount = Ubound( sList() ) then iCount = 0
LinSearch = iCount
end function