diff options
Diffstat (limited to 'source/text/sbasic/shared/03090412.xhp')
-rw-r--r-- | source/text/sbasic/shared/03090412.xhp | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/source/text/sbasic/shared/03090412.xhp b/source/text/sbasic/shared/03090412.xhp index 13557ee7c6..80d0ac3dea 100644 --- a/source/text/sbasic/shared/03090412.xhp +++ b/source/text/sbasic/shared/03090412.xhp @@ -47,7 +47,9 @@ <paragraph role="paragraph" id="par_id3153394" xml-lang="en-US" l10n="U" oldref="2">Exits a <emph>Do...Loop</emph>, <emph>For...Next</emph>, a function, or a subroutine.</paragraph> </section> <paragraph role="heading" id="hd_id3149763" xml-lang="en-US" level="2" l10n="U" oldref="3">Syntax:</paragraph> -<paragraph role="paragraph" id="par_id3159157" xml-lang="en-US" l10n="U" oldref="4">see Parameters</paragraph> +<bascode>
+<paragraph role="bascode" id="par_id3159157" xml-lang="en-US" oldref="4">see Parameters</paragraph>
+</bascode> <paragraph role="heading" id="hd_id3148943" xml-lang="en-US" level="2" l10n="U" oldref="5">Parameters:</paragraph> <paragraph role="paragraph" id="par_id3154760" xml-lang="en-US" l10n="U" oldref="6"> <emph>Exit Do</emph> @@ -67,28 +69,31 @@ <paragraph role="paragraph" id="par_id3149561" xml-lang="en-US" l10n="U" oldref="13">Exits the subroutine immediately. Program execution continues with the statement that follows the <emph>Sub</emph> call.</paragraph> <paragraph role="note" id="par_id3153143" xml-lang="en-US" l10n="U" oldref="14">The Exit statement does not define the end of a structure, and must not be confused with the End statement.</paragraph> <paragraph role="heading" id="hd_id3147348" xml-lang="en-US" level="2" l10n="U" oldref="15">Example:</paragraph> -<paragraph role="paragraph" id="par_id3151113" xml-lang="en-US" l10n="U" oldref="16">Sub ExampleExit</paragraph> -<paragraph role="paragraph" id="par_id3156283" xml-lang="en-US" l10n="U" oldref="17">Dim sReturn As String</paragraph> -<paragraph role="paragraph" id="par_id3147125" xml-lang="en-US" l10n="U" oldref="18">Dim sListArray(10) as String</paragraph> -<paragraph role="paragraph" id="par_id3151073" xml-lang="en-US" l10n="U" oldref="19">Dim siStep as Single</paragraph> -<paragraph role="paragraph" id="par_id3153158" xml-lang="en-US" l10n="U" oldref="20">For siStep = 0 to 10 REM Fill array with test data</paragraph> -<paragraph role="paragraph" id="par_id3148457" xml-lang="en-US" l10n="U" oldref="21">sListArray(siStep) = chr(siStep + 65)</paragraph> -<paragraph role="paragraph" id="par_id3154492" xml-lang="en-US" l10n="U" oldref="22">msgbox sListArray(siStep)</paragraph> -<paragraph role="paragraph" id="par_id3154791" xml-lang="en-US" l10n="U" oldref="23">next siStep</paragraph> -<paragraph role="paragraph" id="par_id3153510" xml-lang="en-US" l10n="U" oldref="24">sReturn = LinSearch(sListArray(), "B")</paragraph> -<paragraph role="paragraph" id="par_id3154513" xml-lang="en-US" l10n="U" oldref="25">Print sReturn</paragraph> -<paragraph role="paragraph" id="par_id3149121" xml-lang="en-US" l10n="U" oldref="26">end sub</paragraph> -<paragraph role="paragraph" id="par_id3152962" xml-lang="en-US" l10n="U" oldref="29">Function LinSearch( sList(), sItem As String ) as integer</paragraph> -<paragraph role="paragraph" id="par_id3154755" xml-lang="en-US" l10n="U" oldref="30">dim iCount as Integer</paragraph> -<paragraph role="paragraph" id="par_id3153764" xml-lang="en-US" l10n="U" oldref="31">REM LinSearch searches a TextArray:sList() for a TextEntry:</paragraph> -<paragraph role="paragraph" id="par_id3148995" xml-lang="en-US" l10n="U" oldref="32">REM Returns the index of the entry or 0 ( Null)</paragraph> -<paragraph role="paragraph" id="par_id3156057" xml-lang="en-US" l10n="U" oldref="33">for iCount=1 to Ubound( sList() )</paragraph> -<paragraph role="paragraph" id="par_id3159266" xml-lang="en-US" l10n="U" oldref="34">if sList( iCount ) = sItem then</paragraph> -<paragraph role="paragraph" id="par_id3149567" xml-lang="en-US" l10n="U" oldref="35">Exit for REM sItem found</paragraph> -<paragraph role="paragraph" id="par_id3147343" xml-lang="en-US" l10n="U" oldref="36">end if</paragraph> -<paragraph role="paragraph" id="par_id3155174" xml-lang="en-US" l10n="U" oldref="37">next iCount</paragraph> -<paragraph role="paragraph" id="par_id3146313" xml-lang="en-US" l10n="U" oldref="38">if iCount = Ubound( sList() ) then iCount = 0</paragraph> -<paragraph role="paragraph" id="par_id3166448" xml-lang="en-US" l10n="U" oldref="39">LinSearch = iCount</paragraph> -<paragraph role="paragraph" id="par_id3146916" xml-lang="en-US" l10n="U" oldref="40">end function</paragraph> +<bascode> +<paragraph role="bascode" localize="false" xml-lang="en-US">Sub ExampleExit</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US">Dim sReturn As String</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US">Dim sListArray(10) As String</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US">Dim siStep As Single</paragraph> +<paragraph role="bascode" id="par_id3153158" xml-lang="en-US" l10n="U" oldref="20"> For siStep = 0 To 10 ' Fill array with test data</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> sListArray(siStep) = chr(siStep + 65)</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> MsgBox sListArray(siStep)</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> Next siStep</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> sReturn = LinSearch(sListArray(), "B")</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> Print sReturn</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> </paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US">Function LinSearch( sList(), sItem As String ) As Integer</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US">Dim iCount As Integer</paragraph> +<paragraph role="bascode" id="par_id3153764" xml-lang="en-US" l10n="U" oldref="31">' LinSearch searches a TextArray:sList() for a TextEntry:</paragraph> +<paragraph role="bascode" id="par_id3148995" xml-lang="en-US" l10n="U" oldref="32">' Returns the index of the entry or 0 (Null)</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> For iCount=1 To Ubound( sList() )</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> If sList( iCount ) = sItem Then</paragraph> +<paragraph role="bascode" id="par_id3149567" xml-lang="en-US" l10n="U" oldref="35"> Exit For ' sItem found</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> End If</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> Next iCount</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> If iCount = Ubound( sList() ) Then iCount = 0</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US"> LinSearch = iCount</paragraph> +<paragraph role="bascode" localize="false" xml-lang="en-US">End Function</paragraph> +</bascode> </body> </helpdocument> |