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 SingleFor siStep = 0 to 10 REM Fill array with test datasListArray(siStep) = chr$(siStep + 65)msgbox sListArray(siStep)next siStepsReturn = LinSearch(sListArray(), "B")Print sReturnend subFunction LinSearch( sList(), sItem As String ) as integerdim iCount as IntegerREM 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 thenexit for REM sItem foundend ifnext iCountif iCount = Ubound( sList() ) then iCount = 0LinSearch = iCountend function