Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Use GoSub and Return rather than GoTo for branching to and from subroutines. GoSub and Return make structured programming easier to follow.

See also

GoToOn...GoSubOn...GoToReturn

Example

Code Block
/* The following code fragment shows how to branch to internal subroutines, 
as well as how to return execution to the main program. */
Main:
If Len(InvoiceAmount) Then
  Discount = .10  ;* ten percent
  GoSub FindTotal
End Else
  GoSub PrepareInvoice
End
Return
FindTotal:
* processing here...
Return
PrepareInvoice:
* processing here...
Return