Remote Processing CAMBASIC User Manual

Page 14

Advertising
background image

Concepts - 8

Lower– case characters have a higher ASC II value than upper– case characters. If two strings are identical up to the point
that one string ends, the shorter string is said to have a lower value.

Array Variables
An array is a group or table of values referenced by the same name. Each individual value in the array is called an
element. Array elements are variables and can be used in expressions and in any CAMBASIC statement or function that
uses variables. Declar ing the name and type of an array and setting the number of elements and their arrangem ent in the
array is known as defining or dimensioning the array. U sually, this is done using the DIM statement. For example,

10 DIM G$(100)

This creates a one– dimensional string array named G$. All its elements are variable length strings. The elements are
assigned an initial value of null (empty; zero length).

10 DIM TEMP(20,20)

This creates a two– dimensional array named T EMP . All the arr ay elements have an initial value of zero.

Each array element is named with the array name subscripted with a number or numbers. An ar ray variable name has as
many subscripts as there are dimensions in the array. The subscript indicates the position of the element in the array.
Zero (0) is the lowest position. The maxim um number of dimensions for an array is 255. The maximum number of
elemen ts per dim ension is 32, 767, but available syste m me mor y will pre vent rea ching this limit.

Arrays have a default dimension of 10. This gives a total of 11 elements (0 through 10).

Constants
Constants are literal values. These are “known” values as opposed to variables which can be assigned any value.
Constants may be numeric or string.

A string constant (literal string) is a sequence of characters enclosed in double quotation marks. Exam ples of string
constants are:

"Power"
"Valve 34"
"INPUT PH METER READING"

Numer ic constants are positive and negative numbers. Numer ic constants cannot contain commas. All CAM BASIC
constants are in the range from – 1.7E+ 38 to 1.7E+ 38. Numbers are assumed to be decimal unless an “&” or “@”
prefix is present. The “ &” is a hexadecimal prefix for numbers from &0 to &FF FF. The “@ ” is a binary prefix for
numbers from @00000000 to @11111111. U p to seven digits (decimal) of precision may be specified.

Some examples are:

123

1.5678E + 34

@00110101

.567

15E– 10

– 34.9

&8200

Numer ic constants (numbers) are compiled as entered. The compiled code takes five bytes per constant, regardless of the
number of digits in the constant. Using constants other than variable names in your program speeds execution at the
expense of memory. Due to the compiling process, the maximum number of constants per line is 24. Exceeding that
number will invoke the “C ompile” error message.

Advertising