8
Also, note that if you specify configuration directives for both the pins and the port containing them, the
last occurring directive will prevail.
Example
Option PortA "TPTP0001"
Option Base <value>
Default: 0
Although zero-based arrays are common in many programming languages, some people find it easier to
think about arrays being indexed beginning with 1. The Option Base directive is provided to allow you
to specify that the default array base is either 0 or 1, the <value> element of the directive must be one of
those values.
Note that it is not necessary to use this directive to define 1-based arrays. The syntax for array definitions
(see page 14) allows you to specify any base value that you wish for each array, including a negative
base value if you wish. Some programmers believe that it is better to explicitly indicate the base of the
array indices in each definition. That way, you never have to remember or go find out what the default
base might be.
This option does not affect Program Memory data items which are always 1-based.
Example
Option Base 1
Option Explicit
Default: Off
Traditionally, the purpose of the Option Explicit directive has been to require that each variable in
the program be explicitly defined. Historically, early Basic dialects allowed programs to be written so that
when the compiler encountered a new variable name, it automatically created a definition for it. Although
this may have been thought to be a nice feature, it turned out to be the source of many programming
errors and bugs. If you accidentally misspelled a variable name, a new variable was created entirely
unbeknownst to you. Because of this serious drawback implicit variable definition is not supported by
ZBasic. The Option Explicit directive is accepted by the compiler for compatibility reasons but
neither its presence nor its absence affects any aspect of the compilers operation.
Option Language { BasicX | ZBasic }
Default: ZBasic
By default the compiler processes modules in native mode, i.e. using the rules and defaults for ZBasic.
This option directive can be used to instruct the compiler to process the module using the syntax rules
defined by a specific language variant. If Option Language BasicX is specified, the compiler will
process the module in BasicX compatibility mode. This may be useful in certain peculiar situations if you
have existing modules written for BasicX. In most cases, existing BasicX code will compile correctly in
native mode with few, if any, changes.
If you need to utilize BasicX compatibility mode you should be aware that none of the enhanced language
features nor any of the enhanced System Library routines of ZBasic will be available in that module.
Also, using Option Language BasicX changes the defaults for some of the other options as listed in
the table below. You may still change the prevailing setting of these other options by utilizing the related
option directive either before or after this option directive.