GOTO

BS1 icon BS2 icon BS2e icon BS2sx icon BS2p icon BS2pe icon BS2px icon

GOTO Example

 

 

 

Syntax: GOTO Address

Function

Jump the point in the program specified by Address.

Quick Facts

  BS1 All BS2 Models
Related Commands

BRANCH, GOSUB

ON...GOTO, BRANCH, GOSUB

Max. GOTOs
per program
Unlimited, but good programming practices suggest minimizing the use of GOTO.

Explanation

The GOTO command makes the BASIC Stamp execute the code that starts at the specified Address location. The BASIC Stamp reads PBASIC code from left-to-right, top-to-bottom, just like in the English language. The GOTOcommand forces the BASIC Stamp to jump to another section of code.

A common use for GOTO is to create endless loops; programs that repeat a group of instructions over and over. For example:

Hello:
  DEBUG "Hi", CR
  PAUSE 500
  GOTO Hello

The above code will print "Hi" on the screen, over and over again. The GOTO Hello line simply tells it to go back to the code that begins with the label Hello.

Go to PBASIC Language home page

Open Getting Started with Stamps in Class

Open Connection Troubleshooting

BASIC Stamp Help Version 2.5.4

Copyright © Parallax Inc.

8/21/2013