IBM Lotus Symphony
|
Definira podprogram, ki se lahko uporablja kot izraz za določanje vrste vrnjenega podatka.
Glejte odsek Parametri
Skladnja
Function Name[(VarName1 [As Type][, VarName2 [As Type][,...]]]) [As Type]
blok stavka
[Exit Function]
blok stavka
End Function
Parameter
Name (Ime): Ime podprograma, ki vsebuje vrednost, ki jo vrne funkcija.
VarName (Ime spremenljivke): Parameter, ki bo posredovan podprogramu.
Type (Vrsta): Ključna beseda deklaracije vrste.
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