Specifications
BASIC Stamp II
Page 268 • BASIC Stamp Programming Manual 1.8 • Parallax, Inc.
Goto
GOTO
addressLabel
Go to the point in the program specified by addressLabel.
• AddressLabel is a label that specifies where to go.
Explanation
Programs execute from the top of the page (or screen) toward the bot-
tom, and from left to right on individual lines; just the same way we
read and write English. Goto is one of the instructions that can change
the order in which a program executes by forcing it to go to a labeled
point in the program.
A common use for Goto is to create endless loops; programs that re-
peat a group of instructions over and over.
Goto requires an address label for a destination. A label is a word start-
ing with a letter, containing letters, numbers, or underscore (_) charac-
ters, and ending with a colon. Labels may be up to 32 characters long.
Labels must not duplicate names of PBASIC2 instructions, or variables,
constants or Data labels, refer to Appendix B for a list of reserved words.
Labels are not case-sensitive, so doItAgain, doitagain and DOitAGAIN
all mean the same thing to PBASIC. Don’t worry too much about the
rules for devising labels; PBASIC will complain with an error message
at download time if it doesn’t like your labels.
Demo Program
This program is an endless loop that sends a Debug message to your
computer screen. Although you can clear the screen by pressing a key,
the BS2 program itself won’t stop unless you shut it off.
doItAgain:
debug "Looping...",cr
GOTO doItAgain










