GoSub...Return Statement [Runtime]/text/sbasic/shared/03090301.xhpSun Microsystems, Inc.converted from old format - fpeGoSub...Return statementGoSub...Return Statement [Runtime]Calls a subroutine that is indicated by a label from a subroutine 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.Syntax:see ParametersParameters:Sub/Functionstatement block Labelstatement blockGoSub LabelExit Sub/FunctionLabel:statement blockReturnEnd Sub/FunctionThe 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 (":").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.Example:Sub ExampleGoSubdim iInputa as Singledim iInputb as Singledim iInputc as SingleiInputa = Int(InputBox$ ("Enter the first number: ","NumberInput"))iInputb = Int(InputBox$ ("Enter the second number: ","NumberInput"))iInputc=iInputaGoSub SquareRootPrint "The square root of";iInputa;" is";iInputciInputc=iInputbGoSub SquareRootPrint "The square root of";iInputb;" is";iInputcExit SubSquareRoot:iInputc=sqr(iInputc)ReturnEnd Sub