From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- .../source/text/sbasic/shared/03090412.xhp | 87 ++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 helpcontent2/source/text/sbasic/shared/03090412.xhp (limited to 'helpcontent2/source/text/sbasic/shared/03090412.xhp') diff --git a/helpcontent2/source/text/sbasic/shared/03090412.xhp b/helpcontent2/source/text/sbasic/shared/03090412.xhp new file mode 100644 index 000000000..adad55212 --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/03090412.xhp @@ -0,0 +1,87 @@ + + + + + + + Exit Statement + /text/sbasic/shared/03090412.xhp + + + + + + +
+ + Exit statement + + + +

Exit Statement

+Exits a Do...Loop, For...Next, a function, a property, or a subroutine. +
+ + + +Exit Do, Exit For, Exit Function, Exit Property, Exit Sub + + + + Exit Do +Only valid within a Do...Loop statement to exit the loop. Program execution continues with the statement that follows the Loop statement. If Do...Loop statements are nested, the control is transferred to the loop in the next higher level. + Exit For +Only valid within a For...Next loop to exit the loop. Program execution continues with the first statement that follows the Next statement. In nested statements, the control is transferred to the loop in the next higher level. + Exit Function +Exits the Function procedure immediately. Program execution continues with the statement that follows the Function call. + Exit Property +Exits the Property procedure immediately. Program execution continues with the statement that follows the Property call. + Exit Sub +Exits the subroutine immediately. Program execution continues with the statement that follows the Sub call. +The Exit statement does not define the end of a structure, and must not be confused with the End statement. + + + +Sub ExampleExit +Dim sReturn As String +Dim sListArray(10) As String +Dim 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 sReturn +End Sub + +Function LinSearch( sList(), sItem As String ) As Integer +Dim iCount As Integer +' LinSearch searches a TextArray:sList() for a TextEntry: +' Returns 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 = iCount +End Function + + +
\ No newline at end of file -- cgit v1.2.3