Variables; Variable Arrays - Omron C200H-ASC11 Manual

Ascii units
Hide thumbs Also See for C200H-ASC11:
Table of Contents

Advertisement

Program Configuration
7-4-5

Variables

Variable Name
Type Declarator
7-4-6

Variable Arrays

Variables are names used to represent values that are used in a BASIC pro-
gram. The value of a variable may be assigned as the result of calculations or
explicitly by the programmer with an assignment statement. If no value is
assigned to a numeric variable, it is assumed to be zero. If no value is
assigned to a character variable, it is assumed to be the null string.
Variable
Variables are made up of the variable name and the type declarator.
Variable
A variable may be up to 255 alphanumeric characters long. All characters are
valid. No variable can start with "FN" or a BASIC command name.
If a parameter begins with a reserved word, a SYNTAX ERROR will occur.
TOTAL and ABSOL, for example, cannot be used because they include
reserved words TO and ABS.
The variable TYPE can be declared. This is done using a type declarator that
is placed after the variable name. Even if two variables have the same name,
they will be treated differently if they are declared as different types of vari-
ables.
%
Short Integer
&
Long integer
!
Single-precision real
#
Double-precision real
$
Character
Note There is a second way to declare variable types. The BASIC statements
DEFINT, DEFLNG, DEFSTR, DEFSNG, and DEFDBL may be used to declare
the types for certain variable names, starting with a certain letter. By default,
all variables are declared as single-precision.
An array is a group of values of the same TYPE (either numeric or alphabetic)
that is stored and referenced as a unit by the same variable name. Each ele-
ment in an array has a unique position and is referenced by the name of the
array subscripted with an integer or integer expression.
There can be many dimensions to an array. The most common types are
one-, two-, and three-dimensional arrays. The number of dimensions of an
Character
Numeric
Integer (%, &)
Real number
Variable name
+
up to 255 characters
starting with an
alphabetic character
Uses 2 bytes per variable.
Uses 4 bytes per variable
Uses 4 bytes per variable.
Uses 8 bytes per variable.
Uses up to 255 characters. Example: A$
Section 7-4
Short integer (%)
Long integer (&)
Single-precision (!)
Double-precision (#)
Type declarator
Character variable:
Short integer:
Long integer:
Single-precision real: !
Double-precision real: #
Example: A%
Example: A&
Example: A or A!
Example: A#
$
%
&
125

Advertisement

Table of Contents
loading

This manual is also suitable for:

C200h-asc21C200h-asc31

Table of Contents