GOTO label

Description:

GOTO causes Liberty BASIC to proceed to the program code following the label, using the form 'GOTO label'. The label can be either a traditional line number or a branch label in the format [branchLabel] where the branch label name can be any upper/lowercase letter combination. Spaces and digits are not allowed.

Here are some valid branch labels: [mainMenu] [enterLimits] [repeatHere]

Here are some invalid branch labels: [enter limits] mainMenu [1moreTime]

Usage:

  .
  .
[repeat]
  .
  .
[askAgain]
  print "Make your selection (m, r, x)."
  input selection$
  if selection$ = "M" then goto [menu]
  if selection$ = "R" then goto [repeat]
  if selection$ = "X" then goto [exit]
  goto [askAgain]
  .
  .
[menu]
  print "Here is the main menu."
  .
  .
[exit]
  print "Okay, bye."
  end

Notes:

In the lines containing IF . . . THEN GOTO, the GOTO is optional.

The expression IF . . . THEN [menu] is just as valid as

IF . . . THEN GOTO [menu]. But in the line GOTO [askAgain], the GOTO

is required.

See also GOSUB