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.

Syntax:


GoSub label[:]

Parameters:

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
ཉེན་བརྡའི་ངོས་དཔར།

ལས་རིམ་དེ་གིས་སླར་ལོག་གསལ་བཤདའགྱོ་འོག་མ་གྱིས་སྦོམ་མ་བཟོ་མི་གདོང་ཐུག་འབྱུང་པ་ཅིན་ LibreOffice གཞི་རིམ་གྱིས་འཕྲིན་དོན་འཛོལ་བ་ཅིག་སླར་ལོགཔ་ཨིན། ལས་རིམ་དེ་གིས་ཤུལ་མ་སླར་ལོག་གསལ་བཤད་དེ་མ་ལྷོད་པའི་ཧེ་མ་འོག་མ་ཡང་ན་ལས་འགན་གྱིས་བཀོག་བཞག་ཡོད་ངེས་ཏིག་ལུ་ ཕྱིར་ཐོན་འོག་མ་ ཡང་ན་ ཕྱིར་ཐོན་ལས་འགན ལག་ལེན་འཐབ།


འོག་གི་དཔེར་བརྗོད་ཀྱིས་འགྱོ་འོག་མ་ དང་ སླར་ལོག་གི་ལག་ལེན་འཐབ་ཐངས་དེ་འགྲེམས་སྟོནམ་ཨིན། ལས་རིམ་དབྱེ་ཚན་ཚར་གཉིས་ལག་ལེན་འཐབ་དེ་གིས་ ལས་རིམ་གྱིས་ལག་ལེན་པ་གིས་བཙུགས་ཡོད་མི་ཨང་གཉིས་ཀྱི་གྲུ་བཞི་ནར་མོ་རྩ་བ་དེ་རྩིས་སྟོནམ་ཨིན།

Example:


Sub ExampleGoSub
Dim iInputa As Single
Dim iInputb As Single
Dim iInputc As Single
    ཨའི་ཨིན་པུཊི་ཨེ་ = ཨིན་ཊི་(ཨིན་པུཊི་སྒྲོམ་$ "Enter the first number: ","NumberInput"))
    ཨའི་ཨིན་པུཊི་བི་ = ཨིནཊི(ཨིན་པུཊི་སྒྲོམ་$ "Enter the second number: ","NumberInput"))
    iInputc=iInputa
    GoSub SquareRoot
    དཔར་བསྐྲུན་འབད་ "The square root of";iInputa;" is"ཨིན་པིཊི་སི།
    iInputc=iInputb
    GoSub SquareRoot
    དཔར་བསྐྲུན་འབད "The square root of";iInputb;" is"ཨའི་ཨིན་པུཊི་་སི།
    Exit Sub
SquareRoot:
    iInputc=sqr(iInputc)
    Return
End Sub

Please support us!