BASIC Anywhere Machine

2024-09-09 Release Notes

BASIC Language Updates /

New LABELEXISTS Function

(Related: Line Identifier Validation)

Normally (in this latest version of BAM), an invalid line number/label in a GOTO / GOSUB / RESTORE statement, when encountered, will cause a program to immediately  end with an error.

For GOTO / GOSUB / RESTORE in the following scenarios, it would normally make sense for the program to immediately end with an error:

  • IF THEN line-number ELSE line-number
  • IF GOTO line-number/label ELSE line-number/label
  • GOTO line-number/label
  • GOSUB line-number/label
  • RESTORE line-number/label
  • ON ... GOTO
  • ON ... GOSUB
  • ON ... RESTORE

However, when a GOTO / GOSUB / RESTORE statement uses the EVAL clause, there may be scenarios in which dynamically generated line numbers/labels ought to be validated beforehand, allowing the program to do some error handling that prevents abnormal end of the program.