Function Statement [Runtime]/text/sbasic/shared/03090406.xhpSun Microsystems, Inc.converted from old format - fpeFunction statementFunction Statement [Runtime]Defines a subroutine that can be used as an expression to determine a return type.Syntaxsee ParameterParameters:SyntaxFunction Name[(VarName1 [As Type][, VarName2 [As Type][,...]]]) [As Type]statement block[Exit Function]statement blockEnd FunctionParameterName: Name of the subroutine to contain the value returned by the function.VarName: Parameter to be passed to the subroutine.Type: Type-declaration keyword.Example:Sub ExampleExitDim sReturn As StringDim sListArray(10) As StringDim siStep As Single For siStep = 0 To 10 ' Fill array with test data sListArray(siStep) = chr$(siStep + 65) MsgBox sListArray(siStep) Next siStep sReturn = LinSearch(sListArray(), "B") Print sReturnEnd SubFunction LinSearch( sList(), sItem As String ) As IntegerDim iCount As Integer' Linsearch searches a TextArray:sList() for a TextEntry:' Return value Is the index of the entry Or 0 (Null) For iCount=1 To Ubound( sList() ) If sList( iCount ) = sItem Then Exit For ' sItem found End If Next iCount If iCount = Ubound( sList() ) Then iCount = 0 LinSearch = iCountEnd Function