ArcBasicDocs

Introduction

An ArcBasic program is a text file, usually ending in .abs, holding a list of statements. The computer carries them out one after another, from the top down, unless a statement such as If, For or a function call sends it elsewhere.

; my first programPrint "Hello!"name$ = Input("What's your name? ")Print "Nice to meet you, " + name$WaitKey

Each statement normally has a line to itself. To put several on one line, separate them with a colon: x = 1 : y = 2. Capitals don't matter anywhere in the language: PRINT, print and Print are the same, and so are score and Score.

How a program runs

Pressing F5 in the editor first checks the whole program and turns it into compact instructions for ArcBasic's runtime. If something is wrong, such as a misspelt command or a missing End If, the program doesn't start: the editor shows what it didn't understand and marks the line. Mistakes that can only show up while the program runs, such as reading past the end of an array, stop it with a message saying what went wrong and where.

A program ends when it reaches its last line, or an End statement. Functions and type definitions can be anywhere in the file; ArcBasic finds them before the program starts.

What's in this reference

The chapters that follow describe the language itself: how to write numbers and text, how variables, arrays and your own types work, how to make decisions and loops, and how to write functions. The hundreds of commands that draw, play sounds, read the keyboard and build 3D worlds are described in the command reference.