GoSub...Return Statement /text/sbasic/shared/03090301.xhp
GoSub...Return statement label; in GoSub...Return statement

GoSub...Return Statement

Calls a subroutine that is indicated by a label inside a Sub or a Function. The statements following the label are executed until the next Return statement. Afterwards, the program continues with the statement that follows the GoSub statement.
GoSub label[:] label: A line identifier indicating where to continue execution. The scope of a label in that of the routine it belongs to. The GoSub statement calls a local subroutine indicated by a label from within a subroutine or a function. The name of the label must end with a colon (":"). Sub/Function foo ' statements GoSub label ' statements Exit Sub/Function label: ' statements Return End Sub/Function If the program encounters a Return statement not preceded by GoSub, $[officename] Basic returns an error message. Use Exit Sub or Exit Function to ensure that the program leaves a Sub or Function before reaching the next Return statement. The following example demonstrates the use of GoSub and Return. By executing a program section twice, the program calculates the square root of two numbers that are entered by the user. Sub ExampleGoSub Dim iInputa As Single Dim iInputb As Single Dim iInputc As Single iInputa = Int(InputBox("Enter the first number: ","NumberInput")) iInputb = Int(InputBox("Enter the second number: ","NumberInput")) iInputc=iInputa GoSub SquareRoot Print "The square root of";iInputa;" is";iInputc iInputc=iInputb GoSub SquareRoot Print "The square root of";iInputb;" is";iInputc Exit Sub SquareRoot: iInputc=sqr(iInputc) Return End Sub
office-6-1+backports'>distro/lhm/libreoffice-6-1+backports LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/include/rtl/strbuf.h
AgeCommit message (Collapse)Author
2017-10-23loplugin:includeform: UNO API include filesStephan Bergmann
Change these back to consistently use the "..." form to include other UNO API include files, for the benefit of external users of this API. Change-Id: I9c9188e895eb3495e20a71ad44abfa2f6061fa94
2014-11-20Introduce OStringBuffer::appendUninitializedStephan Bergmann
...corresponding to the OUStringBuffer couterpart Change-Id: I3ab03343696e6755cf1ccc470e4decc2f41d2558