Keyword Reference

This section contains an alphabetical listing of all of the PowerBASIC keywords. Each entry goes into specific detail about each command, and is cross-references to other relevant commands. The Programming Reference topics in this help file describe theory and example usage of a selection of essential commands.

The commands can be classified into four primary categories, according to their syntactic class: functions, statements, system variables, and metastatements:

Functions

These are predefined PowerBASIC functions, as opposed to user-defined functions. Functions generally return either a string or a numeric value, and these can be used within a more complex expression. Most functions require the program pass one or more arguments to them; these arguments being numeric or string, or combinations thereof, depending on the function. For example:

T = COS(3.1!)

sResult = FORMAT$(T)

A$ = CHR$(123, "hello", 65, 66, 67, 65 TO 97)

Statements

Statements are building blocks that make up programs. They instruct the compiler to perform specific actions, such as opening a file, setting the date, sending data to a device, etc. Statements do not return a value, but often take one or more arguments. Each statement must appear on a line by itself; or be separated from other program elements with a delimiting colon (:) character. For example:

A& = A& + 10& : B$ = "PowerBASIC"

OPEN "A Long Filename.txt" FOR BINARY AS #1

Count& = 100

System variables

System variables allow a program to interact with the system (in this sense, "system" means the computer, the operating system, the internal run-time code, etc). System variables are predefined by PowerBASIC, and can be used to access and control certain information maintained by the system. For example:

A$ = DATE$

DATE$ = "03-03-2003"

ErrVal = ERRCLEAR

B$ = TIME$

TIME$ = "03:00"

Metastatements

Metastatements are instructions that control the action of the PowerBASIC compiler. Strictly speaking, metastatements are not part of the BASIC language because they do not operate at run-time (when the program is executing). Like compiler option-switches, metastatements can be used to determine how the compiler will operate during the compilation of program code (compile-time).

Metastatements are prefixed with a number (#) symbol to differentiate them from normal statements. Metastatements may take one or more arguments. For example:

#COMPILE EXE "The target filename.exe"

#OPTION VERSION4

#DIM ALL

#INCLUDE "WIN32API.INC"

Please note that PowerBASIC supports both the dollar ($) symbol and a the pound (#) symbol as a metastatement prefixes.

See Also

Format and typefaces

Command Summary