ZX BASIC:Identifier

From BorielWiki
Jump to: navigation, search
Itinerary: Language Reference
Up: Language Syntax
Previous Next
Data Types Data Types Operators Operators


Itinerary: Reserved Identifiers
Up: Language Reference
Next
ABS ABS


Identifiers are used in your ZX BASIC program to define variable names, function names, subroutine names and labels. ZX Basic identifiers must start with a letter (a..z / A..Z) followed by an arbitrary number of letters and or digits. Original Sinclair BASIC allows spaces within variable names, but ZX BASIC does not (in fact, I found it a bit confusing!)

Some identifiers are reserved words. Most of them are either BASIC statements or functions. Functions return a value to be used in an expression whilst statements do not.

Note that there are a number of common statements that you may find in ZX BASIC programs that are not technically reserved words, but library functions. Some of the internal libraries form functions that may overlap with your subroutine and function names (such as POS). So while they may not be technically reserved, you should consider the library function names as ones you should avoid. Also, some Sinclair Basic statements are implemented as library functions, so you should be especially aware of identifiers of this type, such as INPUT, POINT and ATTR.

Reserved Identifiers

The following identifiers are reserved words, and can't be used as variables, functions or labels. Reserved identifiers are case insensitive (it doesn't matter whether you write them in upper or lower case letters, or a mix of them). So PRINT, print and PrInT means all the same in ZX BASIC. On the other hand, non-reserved words can be either case sensitive or not (depending on the options) in effect.

Identifiers shown in bold are taken from the Sinclair BASIC (beware their meaning here might be different, however). Some of them has been marked as statements, functions or operators:

Inbuilt library Functions

You should also avoid defining (with a SUB or FUNCTION command) routines with the following names, as they are available in the internal library for your use, though you are almost certainly going to need to use #include before using them. Note that some Sinclair Basic words are listed here. Some Freebasic commands are also available through #include options for compatibility with freebasic.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox
Translate
Google AdSense