GoTo Command

Purpose

Unconditional branch

Syntax

GoTo label

label:user defined label

Description

Markers are positions within the GFA-BASIC program, used by Restore and GoTo. Restore mar is always used together with the Data lines. GoTo label is an unconditional jump to a previously defined marker label.

GoTo can jump either to a label within the main program or within a procedure. A GoTo between PROCEDUREs and/or FUNCTIONs is not allowed, and jumps in or out of loops are also forbidden.

Example

OpenW # 1

Print "Goto example"

Print

Print "The program is at position 1"

GoTo p2

Print "The program is at position 2"

p2:

Print "The program is at position 3"

Remarks

A label might consist of a number (10) or start with alphanumeric character followed by more characters and ended with a semi-colon (p2:).

The label has function scope and cannot be redeclared within the function. However, the same name can be used as a label in different functions.

See Also

Gosub, Exit If

{Created by Sjouke Hamstra; Last updated: 08/10/2014 by James Gaite}