home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2003 December
/
Chip_2003-12_cd2.bin
/
oo
/
download
/
f_0019
/
sbasic.jar
/
text
/
sbasic
/
common
/
03090406.xml
< prev
next >
Wrap
Extensible Markup Language
|
2003-01-16
|
3KB
|
59 lines
<?xml version="1.0" encoding="utf-8"?>
<html><head><title>Příkaz Function [Runtime]</title><meta name="filename" content="text/sbasic/common/03090406"/><meta name="language" content="en-US"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
p.P1{
}
p.P2{
}
span.T1{
font-weight:bold;}
</style></head><body>
<help:to-be-embedded Eid="function" xmlns:help="http://openoffice.org/2000/help">
<p class="Head1"><help:link Id="66518">Příkaz Function [Runtime]</help:link></p>
<p class="Paragraph">Definuje proceduru typu Sub, kterou lze použít jako výraz ke zjištění návratového typu.</p>
</help:to-be-embedded>
<p class="P2">Syntaxe:</p>
<p class="Paragraph">viz Parametr <help:key-word value="Funkce" tag="kw66518_1" xmlns:help="http://openoffice.org/2000/help"/></p>
<p class="Paragraph"><span class="T1">Parametr</span>:</p>
<p class="Paragraph">Syntaxe</p>
<p class="Paragraph"><help:key-word value="Funkce" tag="kw66518_2" xmlns:help="http://openoffice.org/2000/help"/>Function Název[(Název proměnné 1 [As Typ][, Název proměnné 2 [As Typ][,...]]]) [As Typ]</p>
<p class="Paragraph">blok příkazů</p>
<p class="Paragraph">[Exit Function]</p>
<p class="Paragraph">blok příkazů</p>
<p class="Paragraph">End Function</p>
<p class="Paragraph">Parametr</p>
<p class="Paragraph">Název: Název procedury typu Sub obsahující hodnotu, kterou vrátí funkce.</p>
<p class="Paragraph">Název proměnné: Parametr, který se zadává do procedury typu Sub.</p>
<p class="Paragraph">Typ: Klíčové slovo deklarace typu.</p>
<p class="P2">Příklad:</p>
<p class="PropText">Sub ExampleExit</p>
<p class="PropText">Dim sReturn As String</p>
<p class="PropText">Dim sListArray(10) as String</p>
<p class="PropText">Dim siStep as Single</p>
<p class="PropText">For siStep = 0 to 10 <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>REM Fill array with test data</p>
<p class="PropText">sListArray(siStep) = chr$(siStep + 65)</p>
<p class="PropText">msgbox sListArray(siStep)</p>
<p class="PropText">next siStep</p>
<p class="PropText">sReturn = LinSearch(sListArray(), "B")</p>
<p class="PropText">Print sReturn</p>
<p class="PropText">end sub</p>
<p class="PropText"/>
<p class="PropText"/>
<p class="PropText">Function LinSearch( sList(), sItem As String ) as integer</p>
<p class="PropText">dim iCount as Integer</p>
<p class="PropText">REM Linsearch searches a TextArray:sList() for a TextEntry:</p>
<p class="PropText">REM Return value is the index of the entry or 0 (Null)</p>
<p class="PropText">for iCount=1 to Ubound( sList() )</p>
<p class="PropText">if sList( iCount ) = sItem then</p>
<p class="PropText">exit for REM sItem found</p>
<p class="PropText">end if</p>
<p class="PropText">next iCount</p>
<p class="PropText">if iCount = Ubound( sList() ) then iCount = 0</p>
<p class="PropText">LinSearch = iCount</p>
<p class="PropText">end function</p>
<p class="PropText"/>
<p class="PropText"/>
</body></html>