IBM Lotus Symphony


Function 语句 [运行时]

定义可以用作表达式的子例程以确定返回类型。

语法

请参阅“参数”

参数:

语法

Function Name[(VarName1 [As Type][, VarName2 [As Type][,...]]]) [As Type]

语句块

[Exit Function]

语句块

End Function

参数

Name:含有函数返回值的子例程的名称。

VarName:传递给子例程的参数。

Type:类型声明关键字。

示例:

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 Return value is 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


产品反馈 | 其他文档 | 商标