Lotus Symphony 1.2
|
定義可以用作表示式的子常式,以確定傳回類型。
Function Name[(VarName1 [As Type][, VarName2 [As Type][,...]]]) [As Type]
陳述式區塊
[Exit Function]
陳述式區塊
End Function
Sub ExampleExit
Dim sReturn As String
Dim sListArray(10) as String
Dim siStep as Single
For siStep = 0 to 10 REM 用測試資料來填入陣列
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 搜尋 TextEntry 的 TextArray:sList():
REM 傳回值為項目的索引或 0 (空)
for iCount=1 to Ubound( sList() )
if sList( iCount ) = sItem then
exit for REM 找到 sItem
end if
next iCount
if iCount = Ubound( sList() ) then iCount = 0
LinSearch = iCount
end function